[Numpy-svn] r5795 - branches/1.2.x/numpy/core/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Sep 8 07:19:57 EDT 2008


Author: cdavid
Date: 2008-09-08 06:19:47 -0500 (Mon, 08 Sep 2008)
New Revision: 5795

Modified:
   branches/1.2.x/numpy/core/tests/test_print.py
Log:
Split formatting tests to tag long double ones as known failure on win32.

Modified: branches/1.2.x/numpy/core/tests/test_print.py
===================================================================
--- branches/1.2.x/numpy/core/tests/test_print.py	2008-09-07 07:19:21 UTC (rev 5794)
+++ branches/1.2.x/numpy/core/tests/test_print.py	2008-09-08 11:19:47 UTC (rev 5795)
@@ -1,3 +1,5 @@
+import sys
+
 import numpy as np
 from numpy.testing import *
 
@@ -3,5 +5,5 @@
 class TestPrint(TestCase):
 
-    def test_float_types(self) :
+    def _test_float_type(self, type):
         """ Check formatting.
 
@@ -11,11 +13,23 @@
             python float precision.
 
         """
-        for t in [np.float, np.double, np.longdouble] :
-            for x in [0, 1,-1, 1e10, 1e20] :
-                assert_equal(str(t(x)), str(float(x)))
+        for x in [0, 1,-1, 1e10, 1e20] :
+            assert_equal(str(type(x)), str(float(x)))
 
-    def test_complex_types(self) :
+    def test_float(self) :
+        self._test_float_type(np.float)
+
+    def test_double(self) :
+        self._test_float_type(np.double)
+
+    # Not really failure on win32, but with mingw. Get this information this
+    # information is more than I want to do.
+    @dec.knownfailureif(sys.platform == 'win32', 
+                      "long double print is known to fail on windows")
+    def test_longdouble(self) :
+        self._test_float_type(np.longdouble)
+
+    def _test_complex_type(self, type) :
         """Check formatting.
 
             This is only for the str function, and only for simple types.
@@ -23,12 +37,24 @@
             python float precision.
 
         """
-        for t in [np.cfloat, np.cdouble, np.clongdouble] :
-            for x in [0, 1,-1, 1e10, 1e20] :
-                assert_equal(str(t(x)), str(complex(x)))
-                assert_equal(str(t(x*1j)), str(complex(x*1j)))
-                assert_equal(str(t(x + x*1j)), str(complex(x + x*1j)))
+        for x in [0, 1,-1, 1e10, 1e20] :
+            assert_equal(str(type(x)), str(complex(x)))
+            assert_equal(str(type(x*1j)), str(complex(x*1j)))
+            assert_equal(str(type(x + x*1j)), str(complex(x + x*1j)))
 
+    def test_complex_float(self) :
+        self._test_complex_type(np.cfloat)
 
+    def test_complex_double(self) :
+        self._test_complex_type(np.cdouble)
+
+    # Not really failure on win32, but with mingw. Get this information this
+    # information is more than I want to do.
+    @dec.knownfailureif(sys.platform == 'win32', 
+                      "complex long double print is known to fail on windows")
+    def test_complex_longdouble(self) :
+        self._test_complex_type(np.clongdouble)
+
+
 if __name__ == "__main__":
     run_module_suite()




More information about the Numpy-svn mailing list