Handling scalars in tests with NEP 51 numpy >=2 #11521
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contributes to #11320
There are many test failures where numbers do not match when printed in the new numpy >= 2 (the number is printed with the type). This is about printing scalars in numpy >= 2, here is an explanation in numpy itself.
I see three options to fix this:
I chose the first option.
Where I was not sure what the types would be, I used item. (will return an error if there is more than one element)
I tried to make changes to the tests themselves only as a last resort.
Example:
pytest electronics/circular_convolution.py
FAILURES:
All files passed tests locally in numpy
2.1.0
and numpy1.26.4
. Each file was checked separately. Except for the filelinear_algebra/src/power_iteration.py
in numpy 1.26.4 there is a different number on the fourteenth digit after the period, which I think is not significant.Update
the build fails on numpy
2.0.0
and2.1.0
: Getting requirements to build wheel did not run successfully.Checklist: