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

Charles R Harris charlesr.harris@gmail....
Mon Jul 27 09:52:01 CDT 2009


On Mon, Jul 27, 2009 at 1:00 AM, David Cournapeau <
david@ar.media.kyoto-u.ac.jp> wrote:

> 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 ?
>

I think that should be considered a bug.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090727/44b60f2c/attachment.html 


More information about the NumPy-Discussion mailing list