Skip to content
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

Generate NumPy scalars for test inputs #289

Closed
asmeurer opened this issue Sep 3, 2024 · 0 comments · Fixed by #310
Closed

Generate NumPy scalars for test inputs #289

asmeurer opened this issue Sep 3, 2024 · 0 comments · Fixed by #310
Labels
high priority High-priority issue

Comments

@asmeurer
Copy link
Member

asmeurer commented Sep 3, 2024

We should update the arrays strategy so that it can generate NumPy scalars whenever it would generate a 0-D array. This can be done by doing something like

if a.ndim == 0 and draw(booleans()):
    a = a[()]

which would be a no-op in any other library.

There are several issues with NumPy scalars and the array API that are not being caught by the test suite because they aren't being tested. See for instance #287 (NumPy scalars do not have in-place methods), and data-apis/array-api-compat#165 (NumPy scalars were missing __array_namespace__, which to be fair isn't tested anyways #248).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority High-priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant