[Numpy-svn] r4988 - in trunk/numpy/testing: . tests

numpy-svn@scip... numpy-svn@scip...
Tue Apr 8 13:04:39 CDT 2008


Author: cdavid
Date: 2008-04-08 13:04:33 -0500 (Tue, 08 Apr 2008)
New Revision: 4988

Modified:
   trunk/numpy/testing/tests/test_utils.py
   trunk/numpy/testing/utils.py
Log:
Fix test for assert* with nan values + string formatting issue when handling nan.

Modified: trunk/numpy/testing/tests/test_utils.py
===================================================================
--- trunk/numpy/testing/tests/test_utils.py	2008-04-08 05:02:03 UTC (rev 4987)
+++ trunk/numpy/testing/tests/test_utils.py	2008-04-08 18:04:33 UTC (rev 4988)
@@ -90,12 +90,15 @@
             foo(t)
 
     def test_nan_array(self):
-        """Test two arrays with different shapes are found not equal."""
-        a = N.array([1, 2])
-        b = N.array([[1, 2], [1, 2]])
+        """Test arrays with nan values in them."""
+        a = N.array([1, 2, N.nan])
+        b = N.array([1, 2, N.nan])
 
-        self._test_not_equal(a, b)
+        self._test_equal(a, b)
 
+        c = N.array([1, 2, 3])
+        self._test_not_equal(c, b)
+
     def test_string_arrays(self):
         """Test two arrays with different shapes are found not equal."""
         a = N.array(['floupi', 'floupa'])

Modified: trunk/numpy/testing/utils.py
===================================================================
--- trunk/numpy/testing/utils.py	2008-04-08 05:02:03 UTC (rev 4987)
+++ trunk/numpy/testing/utils.py	2008-04-08 18:04:33 UTC (rev 4988)
@@ -216,8 +216,8 @@
             except AssertionError:
                 msg = build_err_msg([x, y],
                                     err_msg
-                                    + '\n(x and y nan location mismatch %s, '
-                                    + '%s mismatch)' % (xnanid, ynanid),
+                                    + '\n(x and y nan location mismatch %s, ' \
+                                    '%s mismatch)' % (xnanid, ynanid),
                                     verbose=verbose, header=header,
                                     names=('x', 'y'))
             val = comparison(x[~xnanid], y[~ynanid])



More information about the Numpy-svn mailing list