[Numpy-svn] r6238 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Mon Dec 29 02:35:09 CST 2008


Author: cdavid
Date: 2008-12-29 02:35:06 -0600 (Mon, 29 Dec 2008)
New Revision: 6238

Modified:
   trunk/numpy/core/tests/test_print.py
Log:
Clearer error messages for formatting failures.

Modified: trunk/numpy/core/tests/test_print.py
===================================================================
--- trunk/numpy/core/tests/test_print.py	2008-12-29 08:26:04 UTC (rev 6237)
+++ trunk/numpy/core/tests/test_print.py	2008-12-29 08:35:06 UTC (rev 6238)
@@ -6,7 +6,8 @@
 
 def check_float_type(tp):
     for x in [0, 1,-1, 1e10, 1e20] :
-        assert_equal(str(tp(x)), str(float(x)))
+        assert_equal(str(tp(x)), str(float(x)),
+                     err_msg='Failed str formatting for type %s' % tp)
 
 def test_float_types():
     """ Check formatting.
@@ -21,7 +22,8 @@
 
 def check_nan_inf_float(tp):
     for x in [float('inf'), float('-inf'), float('nan')]:
-        assert_equal(str(tp(x)), str(float(x)))
+        assert_equal(str(tp(x)), str(float(x)),
+                     err_msg='Failed str formatting for type %s' % tp)
 
 def test_nan_inf_float():
     """ Check formatting.
@@ -36,9 +38,12 @@
 
 def check_complex_type(tp):
     for x in [0, 1,-1, 1e10, 1e20] :
-        assert_equal(str(tp(x)), str(complex(x)))
-        assert_equal(str(tp(x*1j)), str(complex(x*1j)))
-        assert_equal(str(tp(x + x*1j)), str(complex(x + x*1j)))
+        assert_equal(str(tp(x)), str(complex(x)),
+                     err_msg='Failed str formatting for type %s' % tp)
+        assert_equal(str(tp(x*1j)), str(complex(x*1j)),
+                     err_msg='Failed str formatting for type %s' % tp)
+        assert_equal(str(tp(x + x*1j)), str(complex(x + x*1j)),
+                     err_msg='Failed str formatting for type %s' % tp)
 
 def test_complex_types():
     """Check formatting.
@@ -79,7 +84,8 @@
         else:
             locale.setlocale(locale.LC_NUMERIC, 'FRENCH')
 
-        assert_equal(str(tp(1.2)), str(float(1.2)))
+        assert_equal(str(tp(1.2)), str(float(1.2)),
+                     err_msg='Failed locale test for type %s' % tp)
     finally:
         locale.setlocale(locale.LC_NUMERIC, locale=curloc)
 
@@ -91,12 +97,12 @@
 @np.testing.dec.skipif(not has_french_locale(),
                        "Skipping locale test, French locale not found")
 def test_locale_double():
-    return _test_locale_independance(np.float64)
+    return _test_locale_independance(np.double)
 
 @np.testing.dec.skipif(not has_french_locale(),
                        "Skipping locale test, French locale not found")
 def test_locale_longdouble():
-    return _test_locale_independance(np.float96)
+    return _test_locale_independance(np.longdouble)
 
 if __name__ == "__main__":
     run_module_suite()



More information about the Numpy-svn mailing list