Rework prepare_for_test#2
Conversation
mdhaber
left a comment
There was a problem hiding this comment.
A lot of these changes are tweaks to the original code. Did you change your mind about the best variable/function names, docstrings, order, etc.?
| if rtol is None: | ||
| if xp.isdtype(actual.dtype, ("real floating", "complex floating")): | ||
| # multiplier of 4 is used as for `np.float64` this puts the default `rtol` | ||
| # roughly half way between sqrt(eps) and the default for | ||
| # `numpy.testing.assert_allclose`, 1e-7 | ||
| rtol = xp.finfo(actual.dtype).eps ** 0.5 * 4 | ||
| else: | ||
| rtol = 1e-7 |
There was a problem hiding this comment.
No, it was an attempt to convince pyright. Regardless, I think it's slightly cleaner this way.
| actual_np = as_numpy_array(actual, xp=xp) | ||
| desired_np = as_numpy_array(desired, xp=xp) |
There was a problem hiding this comment.
In data-apis#267 all testing becomes done exclusively by numpy.
So it makes sense to push the conversion into this function.
As a cascade effect, this makes type validation on behalf of pyright a lot easier.
|
Shoot, that was supposed to just confirm that the other 16 commits were just a merge. Can you resolve the merge conflicts? I think all you need to do is accept |
done |
* WIP: xp_assert enhancements * ENH: add xp_assert_less * Rework prepare_for_test (#2) * Fix failures in data-apis#267 * Update tests/test_testing.py [skip ci] Co-authored-by: Lucas Colley <lucas.colley8@gmail.com> * Update _testing.py --------- Co-authored-by: Guido Imperiale <crusaderky@gmail.com> Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Part of review of data-apis#267
(change only in last commit; everything else is a merge from main)