diff options
author | rgommers <ralf.gommers@googlemail.com> | 2011-03-12 19:58:10 +0800 |
---|---|---|
committer | rgommers <ralf.gommers@googlemail.com> | 2011-03-12 20:08:45 +0800 |
commit | 45269ee1c906269bc3cd481f7ed94c8100e2b858 (patch) | |
tree | b56b84875caef3459575ee75e000c1373b58c714 /numpy/testing/tests | |
parent | 0de7890ac6cad3d04e4cb32fe8431950eda065fa (diff) | |
download | numpy-45269ee1c906269bc3cd481f7ed94c8100e2b858.tar.gz |
BUG: fix assert_almost_equal and co. to work with infs.
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 9798a25be..067782dc0 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -189,6 +189,13 @@ class TestArrayAlmostEqual(_GenericTest, unittest.TestCase): self.assertRaises(AssertionError, lambda : self._assert_func(ainf, anan)) + def test_inf(self): + a = np.array([[1., 2.], [3., 4.]]) + b = a.copy() + a[0,0] = np.inf + self.assertRaises(AssertionError, + lambda : self._assert_func(a, b)) + class TestAlmostEqual(_GenericTest, unittest.TestCase): def setUp(self): self._assert_func = assert_almost_equal @@ -205,6 +212,8 @@ class TestAlmostEqual(_GenericTest, unittest.TestCase): def test_inf_item(self): self._assert_func(np.inf, np.inf) self._assert_func(-np.inf, -np.inf) + self.assertRaises(AssertionError, + lambda : self._assert_func(np.inf, 1)) def test_simple_item(self): self._test_not_equal(1, 2) |