[Numpy-svn] r6259 - in branches/fix_float_format: . numpy/core/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Dec 30 00:43:21 EST 2008


Author: cdavid
Date: 2008-12-29 23:43:17 -0600 (Mon, 29 Dec 2008)
New Revision: 6259

Modified:
   branches/fix_float_format/
   branches/fix_float_format/numpy/core/tests/test_print.py
Log:
Merged revisions 6258 via svnmerge from 
http://svn.scipy.org/svn/numpy/trunk

........
  r6258 | cdavid | 2008-12-30 14:42:03 +0900 (Tue, 30 Dec 2008) | 1 line
  
  Hardcode reference for inf/nan-involved values.
........



Property changes on: branches/fix_float_format
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/distutils-revamp:1-2752 /branches/dynamic_cpu_configuration:1-6101 /branches/multicore:1-3687 /branches/numpy-mingw-w64:1-6150 /branches/visualstudio_manifest:1-6077 /trunk:1-6244,6251,6253,6256
   + /branches/distutils-revamp:1-2752 /branches/dynamic_cpu_configuration:1-6101 /branches/multicore:1-3687 /branches/numpy-mingw-w64:1-6150 /branches/visualstudio_manifest:1-6077 /trunk:1-6244,6251,6253,6256,6258

Modified: branches/fix_float_format/numpy/core/tests/test_print.py
===================================================================
--- branches/fix_float_format/numpy/core/tests/test_print.py	2008-12-30 05:42:03 UTC (rev 6258)
+++ branches/fix_float_format/numpy/core/tests/test_print.py	2008-12-30 05:43:17 UTC (rev 6259)
@@ -5,6 +5,10 @@
 import sys
 from StringIO import StringIO
 
+_REF = {np.inf: 'inf', -np.inf: '-inf', np.nan: 'nan', complex(np.inf, 1):
+        '(inf+1j)', complex(np.nan, 1): '(nan+1j)', complex(-np.inf, 1):
+        '(-inf+1j)'}
+
 def check_float_type(tp):
     for x in [0, 1,-1, 1e20] :
         assert_equal(str(tp(x)), str(float(x)),
@@ -34,7 +38,7 @@
 
 def check_nan_inf_float(tp):
     for x in [np.inf, -np.inf, np.nan]:
-        assert_equal(str(tp(x)), str(float(x)),
+        assert_equal(str(tp(x)), _REF[x],
                      err_msg='Failed str formatting for type %s' % tp)
 
 def test_nan_inf_float():
@@ -88,7 +92,10 @@
         sys.stdout = file_tp
         print tp(x)
         sys.stdout = file
-        print x
+        if x in _REF:
+            print _REF[x]
+        else:
+            print x
     finally:
         sys.stdout = stdout
 




More information about the Numpy-svn mailing list