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

numpy-svn@scip... numpy-svn@scip...
Tue Feb 9 02:40:36 CST 2010


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

Modified:
   trunk/numpy/testing/utils.py
Log:
ENH: handle complex input for assert_array_almost_equal_nulp.

Modified: trunk/numpy/testing/utils.py
===================================================================
--- trunk/numpy/testing/utils.py	2010-02-09 08:40:23 UTC (rev 8101)
+++ trunk/numpy/testing/utils.py	2010-02-09 08:40:36 UTC (rev 8102)
@@ -1104,9 +1104,12 @@
     ay = np.abs(y)
     ref = nulp * np.spacing(np.where(ax > ay, ax, ay))
     if not np.all(np.abs(x-y) <= ref):
-        max_nulp = np.max(nulp_diff(x, y))
-        raise AssertionError("X and Y are not equal to %d ULP "\
-                             "(max is %g)" % (nulp, max_nulp))
+        if np.iscomplexobj(x) or np.iscomplexobj(y):
+            msg = "X and Y are not equal to %d ULP" % nulp
+        else:
+            max_nulp = np.max(nulp_diff(x, y))
+            msg = "X and Y are not equal to %d ULP (max is %g)" % (nulp, max_nulp)
+        raise AssertionError(msg)
 
 def assert_array_max_ulp(a, b, maxulp=1, dtype=None):
     """Given two arrays a and b, check that every item differs in at most N



More information about the Numpy-svn mailing list