[Numpy-discussion] np.testing.assert_equal

Charles R Harris charlesr.harris at gmail.com
Fri Jan 22 12:35:10 EST 2010


On Fri, Jan 22, 2010 at 10:11 AM, Keith Goodman <kwgoodman at 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.python.org/pipermail/numpy-discussion/attachments/20100122/64594519/attachment.html>


More information about the NumPy-Discussion mailing list