[Numpy-svn] r6274 - branches/fix_float_format/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Tue Dec 30 00:43:05 CST 2008


Author: cdavid
Date: 2008-12-30 00:43:02 -0600 (Tue, 30 Dec 2008)
New Revision: 6274

Modified:
   branches/fix_float_format/numpy/core/tests/test_print.py
Log:
Fix single precision complex/real redirected print tests.

Modified: branches/fix_float_format/numpy/core/tests/test_print.py
===================================================================
--- branches/fix_float_format/numpy/core/tests/test_print.py	2008-12-30 06:38:29 UTC (rev 6273)
+++ branches/fix_float_format/numpy/core/tests/test_print.py	2008-12-30 06:43:02 UTC (rev 6274)
@@ -104,16 +104,36 @@
                  err_msg='print failed for type%s' % tp)
 
 def check_float_type_print(tp):
-    for x in [0, 1,-1, 1e10, 1e20, np.inf, -np.inf, np.nan]:
+    for x in [0, 1,-1, 1e20, np.inf, -np.inf, np.nan]:
         _test_redirected_print(float(x), tp)
 
+    if tp(1e10).itemsize > 4:
+        _test_redirected_print(float(1e10), 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'
+        _test_redirected_print(float(1e10), tp, ref)
+
 def check_complex_type_print(tp):
     # We do not create complex with inf/nan directly because the feature is
     # missing in python < 2.6
-    for x in [0, 1, -1, 1e10, 1e20, complex(np.inf, 1),
+    for x in [0, 1, -1, 1e20, complex(np.inf, 1),
               complex(np.nan, 1), complex(-np.inf, 1)] :
         _test_redirected_print(complex(x), tp)
 
+    if tp(1e10).itemsize > 8:
+        _test_redirected_print(complex(1e10), 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)'
+        _test_redirected_print(complex(1e10), tp, ref)
+
 def test_float_type_print():
     """Check formatting when using print """
     for t in [np.float32, np.double, np.longdouble] :



More information about the Numpy-svn mailing list