-
Notifications
You must be signed in to change notification settings - Fork 744
Description
Is your feature request related to a problem?
The testing code uses pytest and relies on numpy.testing. It contains some deprecated testing constructs such as assert_almost_equal(), assert_array_almost_equal() and some sub-optimal tests (such as testing single floats with an array assertion).
Describe the solution you'd like
Update the testing code, following current best practices, such as
- use
numpy.testing.assert_allclose()instead ofassert_almost_equal()orassert_array_almost_equal()for more consistent floating point comparisons - replace array comparisons for floating point scalars (a single floating point number) with
pytest.approx()(see Nuclinfo Major Pair and Minor Pair overhaul #3735 (comment)) - ...
Please add additional best practices here or in the comments.
Describe alternatives you've considered
We don't have to do anything right now because everything is working.
How to work on this issue
You can open issues for individual points above, you don't have to work on all of them. If you create a new issue, mention this issue number in the issue text so that it gets linked.
Find occurrences of the constructs that you want to change in the code, e.g.,
cd testsuite/
git grep 'assert_almost_equal'Figure out how to change the code to get an equivalent result by learning about the different arguments that the old and the new function take and how they affect the assertion. Then pick one example and implement your solution. See if it works. Improve your example until it works. Only then start converting more of the test files. Get feedback from other developers.