-
Notifications
You must be signed in to change notification settings - Fork 0
Rework prepare_for_test #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework prepare_for_test #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To save microseconds in a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fixing a pyright issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Part of review of data-apis#267
(change only in last commit; everything else is a merge from main)