[Numpy-svn] r8100 - trunk/numpy/testing/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Feb 9 03:40:09 EST 2010


Author: cdavid
Date: 2010-02-09 02:40:09 -0600 (Tue, 09 Feb 2010)
New Revision: 8100

Modified:
   trunk/numpy/testing/tests/test_utils.py
Log:
TST: add simple test for complex arrays input to assert_array_almost_equal_nulp.

Modified: trunk/numpy/testing/tests/test_utils.py
===================================================================
--- trunk/numpy/testing/tests/test_utils.py	2010-02-09 06:11:33 UTC (rev 8099)
+++ trunk/numpy/testing/tests/test_utils.py	2010-02-09 08:40:09 UTC (rev 8100)
@@ -363,6 +363,19 @@
             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)




More information about the Numpy-svn mailing list