[Numpy-discussion] np.testing.assert_equal

2010-01-22 Thread Keith Goodman
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.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] np.testing.assert_equal

2010-01-22 Thread Charles R Harris
On Fri, Jan 22, 2010 at 10:11 AM, Keith Goodman kwgood...@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
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion