summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2010-02-09 08:40:09 +0000
committerDavid Cournapeau <cournape@gmail.com>2010-02-09 08:40:09 +0000
commit9ad03afec07ebc43e1a5315d323f219fa8738d71 (patch)
tree8c2cccd2c9762f3a4665ea8cdb500e6c1c1c0e31 /numpy/testing/tests/test_utils.py
parent88c05e836e527f0780a6a1430f3dc459a215badf (diff)
downloadnumpy-9ad03afec07ebc43e1a5315d323f219fa8738d71.tar.gz
TST: add simple test for complex arrays input to assert_array_almost_equal_nulp.
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r--numpy/testing/tests/test_utils.py13
1 files changed, 13 insertions, 0 deletions
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)