[Numpy-svn] r4975 - trunk/numpy/testing

numpy-svn@scip... numpy-svn@scip...
Mon Apr 7 16:34:10 CDT 2008


Author: cdavid
Date: 2008-04-07 16:34:08 -0500 (Mon, 07 Apr 2008)
New Revision: 4975

Modified:
   trunk/numpy/testing/utils.py
Log:
Fix broken detection of nan in comparison function.

Modified: trunk/numpy/testing/utils.py
===================================================================
--- trunk/numpy/testing/utils.py	2008-04-07 21:23:10 UTC (rev 4974)
+++ trunk/numpy/testing/utils.py	2008-04-07 21:34:08 UTC (rev 4975)
@@ -186,7 +186,7 @@
 
 def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
                          header=''):
-    from numpy.core import asarray, isnan
+    from numpy.core import asarray, isnan, any
     x = asarray(x)
     y = asarray(y)
     try:
@@ -199,7 +199,7 @@
                                 verbose=verbose, header=header,
                                 names=('x', 'y'))
             assert cond, msg
-        if isnan(x) or isnan(y):
+        if any(isnan(x)) or any(isnan(y)):
             # Handling nan: we first check that x and y have the nan at the
             # same locations, and then we mask the nan and do the comparison as
             # usual.



More information about the Numpy-svn mailing list