summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-12-30 05:50:18 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-12-30 05:50:18 +0000
commit733feabcdba9aae2dbc1d71ec17c9b7483e68a1f (patch)
tree091382257cf5cc4c36374900f5f06ef73723f52d /numpy
parentc1c497b67561d7dc6dbfb70d5fc7c1c5f2494a9f (diff)
downloadnumpy-733feabcdba9aae2dbc1d71ec17c9b7483e68a1f.tar.gz
Fix more formatting tests on win32.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_print.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/numpy/core/tests/test_print.py b/numpy/core/tests/test_print.py
index b2111c8f6..3afd4e450 100644
--- a/numpy/core/tests/test_print.py
+++ b/numpy/core/tests/test_print.py
@@ -9,6 +9,11 @@ _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)'}
+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 @@ def check_float_type(tp):
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 @@ def check_complex_type(tp):
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():