[Numpy-svn] r8103 - branches/1.4.x/numpy/testing/tests

numpy-svn@scip... numpy-svn@scip...
Tue Feb 9 02:59:21 CST 2010


Author: cdavid
Date: 2010-02-09 02:59:21 -0600 (Tue, 09 Feb 2010)
New Revision: 8103

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

(cherry picked from commit 6a7be0559ccfb24cf39fe1fe8a11232e18b0d26d)

Modified: branches/1.4.x/numpy/testing/tests/test_utils.py
===================================================================
--- branches/1.4.x/numpy/testing/tests/test_utils.py	2010-02-09 08:40:36 UTC (rev 8102)
+++ branches/1.4.x/numpy/testing/tests/test_utils.py	2010-02-09 08:59:21 UTC (rev 8103)
@@ -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