[Numpy-svn] r8506 - in trunk/numpy/core: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Sun Jul 18 13:17:58 EDT 2010


Author: ptvirtan
Date: 2010-07-18 12:17:58 -0500 (Sun, 18 Jul 2010)
New Revision: 8506

Added:
   trunk/numpy/core/tests/test_arrayprint.py
Modified:
   trunk/numpy/core/arrayprint.py
Log:
BUG: core: format 'nan' and 'inf' also in array repr by default (#1050)

Modified: trunk/numpy/core/arrayprint.py
===================================================================
--- trunk/numpy/core/arrayprint.py	2010-07-18 16:52:48 UTC (rev 8505)
+++ trunk/numpy/core/arrayprint.py	2010-07-18 17:17:58 UTC (rev 8506)
@@ -27,8 +27,8 @@
 _float_output_precision = 8
 _float_output_suppress_small = False
 _line_width = 75
-_nan_str = 'NaN'
-_inf_str = 'Inf'
+_nan_str = 'nan'
+_inf_str = 'inf'
 
 if sys.version_info[0] >= 3:
     from functools import reduce
@@ -59,9 +59,9 @@
         Whether or not suppress printing of small floating point values
         using scientific notation (default False).
     nanstr : str, optional
-        String representation of floating point not-a-number (default NaN).
+        String representation of floating point not-a-number (default nan).
     infstr : str, optional
-        String representation of floating point infinity (default Inf).
+        String representation of floating point infinity (default inf).
 
     See Also
     --------

Added: trunk/numpy/core/tests/test_arrayprint.py
===================================================================
--- trunk/numpy/core/tests/test_arrayprint.py	                        (rev 0)
+++ trunk/numpy/core/tests/test_arrayprint.py	2010-07-18 17:17:58 UTC (rev 8506)
@@ -0,0 +1,10 @@
+import numpy as np
+from numpy.testing import *
+
+class TestArrayRepr(object):
+    def test_nan_inf(self):
+        x = np.array([np.nan, np.inf])
+        assert_equal(repr(x), 'array([ nan,  inf])')
+
+if __name__ == "__main__":
+    run_module_suite()




More information about the Numpy-svn mailing list