[Numpy-svn] r6275 - branches/fix_float_format/numpy/core/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Tue Dec 30 01:50:51 EST 2008
Author: cdavid
Date: 2008-12-30 00:50:42 -0600 (Tue, 30 Dec 2008)
New Revision: 6275
Modified:
branches/fix_float_format/numpy/core/tests/test_print.py
Log:
Use reference for inf/nan.
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:43:02 UTC (rev 6274)
+++ branches/fix_float_format/numpy/core/tests/test_print.py 2008-12-30 06:50:42 UTC (rev 6275)
@@ -104,9 +104,12 @@
err_msg='print failed for type%s' % tp)
def check_float_type_print(tp):
- for x in [0, 1,-1, 1e20, np.inf, -np.inf, np.nan]:
+ for x in [0, 1,-1, 1e20]:
_test_redirected_print(float(x), tp)
+ for x in [np.inf, -np.inf, np.nan]:
+ _test_redirected_print(float(x), tp, _REF[x])
+
if tp(1e10).itemsize > 4:
_test_redirected_print(float(1e10), tp)
else:
@@ -120,8 +123,7 @@
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, 1e20, complex(np.inf, 1),
- complex(np.nan, 1), complex(-np.inf, 1)] :
+ for x in [0, 1, -1, 1e20]:
_test_redirected_print(complex(x), tp)
if tp(1e10).itemsize > 8:
@@ -134,6 +136,10 @@
ref = '(1e+10+0j)'
_test_redirected_print(complex(1e10), tp, ref)
+ _test_redirected_print(complex(np.inf, 1), tp, '(inf+1j)')
+ _test_redirected_print(complex(-np.inf, 1), tp, '(-inf+1j)')
+ _test_redirected_print(complex(-np.nan, 1), tp, '(nan+1j)')
+
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