[Numpy-discussion] np.testing.assert_equal

Charles R Harris charlesr.harris@gmail....
Fri Jan 22 11:35:10 CST 2010


On Fri, Jan 22, 2010 at 10:11 AM, Keith Goodman <kwgoodman@gmail.com> wrote:

> Should
>
> np.testing.assert_equal(np.array(1), 1)
>
> raise an AssertionError? (It currently doesn't.)
>
> The use case I have in mind is that scipy.stats.nanamedian incorrectly
> returns np.array(1.0) for the median of a 1d array while np.median
> correctly returns 1.0. It would be handy if the assert statement
> caught the difference.
> _


Such a change would break most of the current tests. The current form was
chosen to be convenient for most use cases. If you need to check the return
type, then you can write another helper function or use assert_ to combine
several tests.

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


More information about the NumPy-Discussion mailing list