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

Change default printing options in __main__ (tests). #20

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

nennigb
Copy link
Owner

@nennigb nennigb commented Jul 10, 2024

Numpy 2.0 change the default printing options
see https://numpy.org/neps/nep-0051-scalar-representation.html
This change crash doctests on scalars. For instance:

legacy:

>>> 2+np.int64(2)
4

New style:

>>> 2+np.int64(2)
np.int64(4)

This PR propose to use

np.set_printoptions(legacy="1.25")

Only in the test runner file, here __main__.py.

Perhaps we could change the format in doctest when numpy 2 will be more common.

I also change the tol in _fpoly doctest which was sometimes too strict.

Changes the default numpy 2 printing options that crash doctests on scalars.
@nennigb nennigb added the bug Something isn't working label Jul 10, 2024
@nennigb nennigb requested a review from MartinGhienne July 10, 2024 09:16
Sometime tests fail due to too strict tolerance.
Change 1e-12 to 1e-11.
@nennigb nennigb added the CI Continuous integration scripts label Jul 10, 2024
@MartinGhienne
Copy link
Collaborator

Sounds good for me, thanks for the modification ;-)

@MartinGhienne MartinGhienne merged commit cc4fae0 into master Jul 23, 2024
20 checks passed
@MartinGhienne MartinGhienne deleted the fix-test-np2 branch July 23, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CI Continuous integration scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants