-
Notifications
You must be signed in to change notification settings - Fork 44
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
Avoid inplace operators in general tests #287
Comments
Is there a specific test that's failing because of this? I haven't seen it before. I'm a little confused why this would be an issue, since Python automatically converts >>> a = np.bool_(False)
>>> b = np.bool_(True)
>>> a |= b
>>> a
True even though There are tests that test in-place operators directly, which do directly call the
Actually, there's a general issue in the test suite which is that the hypothesis strategies for arrays do not actually generate NumPy scalars. So right now, NumPy scalars are not really tested at all, except in a few places inside of some tests where they are created from indexing. We should really fix this because there are likely several issues with NumPy scalars and the array API (I've already seen others outside of the one you noted here). |
I suppose it becomes a problem once using Here's 1 example, but I've seen it in several other tests as well:
https://github.com/pydata/xarray/actions/runs/10655652392/job/29533434595 You do make a good point of using the operators instead! I'll try that out. |
numpy returns scalars instead of 0d arrays:
And this causes errors in unrelated tests since inplace operators are used in more generic tests:
array-api-tests/array_api_tests/pytest_helpers.py
Line 483 in 4caff28
I don't think using inplace-operators in this case is particularly important and can probably be switched to a normal bitwise or.
xref: numpy/numpy#27305
The text was updated successfully, but these errors were encountered: