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

numpy-svn@scip... numpy-svn@scip...
Mon Dec 29 23:50:22 CST 2008


Author: cdavid
Date: 2008-12-29 23:50:18 -0600 (Mon, 29 Dec 2008)
New Revision: 6260

Modified:
   trunk/numpy/core/tests/test_print.py
Log:
Fix more formatting tests on win32.

Modified: trunk/numpy/core/tests/test_print.py
===================================================================
--- trunk/numpy/core/tests/test_print.py	2008-12-30 05:43:17 UTC (rev 6259)
+++ trunk/numpy/core/tests/test_print.py	2008-12-30 05:50:18 UTC (rev 6260)
@@ -9,6 +9,11 @@
         '(inf+1j)', complex(np.nan, 1): '(nan+1j)', complex(-np.inf, 1):
         '(-inf+1j)'}
 
+if sys.platform == 'win32' and sys.version_info[0] <= 2 and sys.version_info[1] <= 5:
+    _REF[np.float32(1e10)] = '1e+010'
+else:
+    _REF[np.float32(1e10)] = '1e+10'
+
 def check_float_type(tp):
     for x in [0, 1,-1, 1e20] :
         assert_equal(str(tp(x)), str(float(x)),
@@ -18,11 +23,7 @@
         assert_equal(str(tp(1e10)), str(float('1e10')),
                      err_msg='Failed str formatting for type %s' % tp)
     else:
-        if sys.platform == 'win32' and sys.version_info[0] <= 2 and sys.version_info[1] <= 5:
-            ref = '1e+010'
-        else:
-            ref = '1e+10'
-        assert_equal(str(tp(1e10)), ref,
+        assert_equal(str(tp(1e10)), _REF[tp(1e10)],
                      err_msg='Failed str formatting for type %s' % tp)
 
 def test_float_types():
@@ -65,11 +66,7 @@
         assert_equal(str(tp(1e10)), str(complex(1e10)),
                      err_msg='Failed str formatting for type %s' % tp)
     else:
-        if sys.platform == 'win32' and sys.version_info[0] <= 2 and sys.version_info[1] <= 5:
-            ref = '(1e+010+0j)'
-        else:
-            ref = '(1e+10+0j)'
-        assert_equal(str(tp(1e10)), ref,
+        assert_equal(str(tp(1e10)), _REF[tp(1e10)],
                      err_msg='Failed str formatting for type %s' % tp)
 
 def test_complex_types():



More information about the Numpy-svn mailing list