Closed
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.