-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: refactoringinternal improvements to the codeinternal improvements to the code
Description
The current syntax of pytest.approx doesn't work good with arrays. np.allclose must be used to compare arrays.
In
def test_array():
assert np.allclose(np.array([1., 2.]), np.array([1., 2.]))
assert np.all(np.array([1., 2.]) == pytest.approx(np.array([1., 2.])))
the first assert evaluates to true, the second to false.
Something like
assert np.array([1., 2.]) == pytest.approx(np.array([1., 2.]))
Would be the most intuitive if it worked, as it also works with lists.
Metadata
Metadata
Assignees
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: refactoringinternal improvements to the codeinternal improvements to the code