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

David Cournapeau david at ar.media.kyoto-u.ac.jp
Mon Jul 27 03:00:34 EDT 2009


Hi,

    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 ?

cheers,

David



More information about the NumPy-Discussion mailing list