[NumPy-Tickets] [NumPy] #1769: assert_almost_equal and assert_array_almost_equal raise ValueError
NumPy Trac
numpy-tickets@scipy....
Fri Mar 11 10:09:21 CST 2011
#1769: assert_almost_equal and assert_array_almost_equal raise ValueError
---------------------------+------------------------------------------------
Reporter: kwgoodman | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.testing | Version: 1.5.1
Keywords: |
---------------------------+------------------------------------------------
assert_almost_equal() and assert_array_almost_equal() raise a ValueError
instead of AssertionError when the array contains np.inf:
{{{
>> a = np.array([[1., 2.], [3., 4.]])
>> b = a.copy()
>> np.testing.assert_almost_equal(a, b)
>> b[0,0] = np.inf
>> np.testing.assert_almost_equal(a, b)
<snip>
ValueError:
Arrays are not almost equal
x: array([[ 1., 2.],
[ 3., 4.]])
y: array([[ inf, 2.],
[ 3., 4.]])
>> np.testing.assert_array_almost_equal(a, b)
<snip>
ValueError:
Arrays are not almost equal
x: array([[ 1., 2.],
[ 3., 4.]])
y: array([[ inf, 2.],
[ 3., 4.]])
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1769>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list