[Numpy-discussion] Why does assert_array_almost_equal sometimes raise ValueError instead of AssertionError ?

David Cournapeau david@ar.media.kyoto-u.ac...
Mon Jul 27 02:00:34 CDT 2009


    In some cases, some of the testing functions assert_array_* raise a
ValueError instead of AssertionError:

>>> np.testing.assert_array_almost_equal(np.array([1, 2, np.nan]),
np.array([1, 2, 3])) # raises ValueError
>>> np.testing.assert_array_almost_equal(np.array([1, 2, np.inf]),
np.array([1, 2, 3])) # raises AssertionError

This seems at least inconsistent - is there a rationale or should this
be considered as a bug ?



More information about the NumPy-Discussion mailing list