From 9ad03afec07ebc43e1a5315d323f219fa8738d71 Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Tue, 9 Feb 2010 08:40:09 +0000 Subject: TST: add simple test for complex arrays input to assert_array_almost_equal_nulp. --- numpy/testing/tests/test_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'numpy/testing/tests/test_utils.py') diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 1d8fe2870..148cc9159 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -363,6 +363,19 @@ class TestArrayAlmostEqualNulp(unittest.TestCase): assert_array_almost_equal_nulp(x, y, nulp=1000) self.failUnlessRaises(AssertionError, failure) + def test_complex(self): + x = np.random.randn(10) + 1j * np.random.randn(10) + y = x + 1 + def failure(): + assert_array_almost_equal_nulp(x, y, nulp=1000) + self.failUnlessRaises(AssertionError, failure) + + def test_complex2(self): + x = np.random.randn(10) + y = np.array(x, np.complex) + 1e-16 * np.random.randn(10) + + assert_array_almost_equal_nulp(x, y, nulp=1000) + class TestULP(unittest.TestCase): def test_equal(self): x = np.random.randn(10) -- cgit v1.2.1