[Numpy-svn] r8648 - branches/1.5.x/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Tue Aug 17 06:43:44 CDT 2010


Author: rgommers
Date: 2010-08-17 06:43:44 -0500 (Tue, 17 Aug 2010)
New Revision: 8648

Modified:
   branches/1.5.x/numpy/core/tests/test_umath_complex.py
Log:
TST: (backport of r8623)  skip C99 nan/inf tests on Windows.

Modified: branches/1.5.x/numpy/core/tests/test_umath_complex.py
===================================================================
--- branches/1.5.x/numpy/core/tests/test_umath_complex.py	2010-08-17 02:39:06 UTC (rev 8647)
+++ branches/1.5.x/numpy/core/tests/test_umath_complex.py	2010-08-17 11:43:44 UTC (rev 8648)
@@ -1,3 +1,5 @@
+import sys
+
 from numpy.testing import *
 import numpy.core.umath as ncu
 import numpy as np
@@ -6,6 +8,20 @@
 # TODO: conj 'symmetry'
 # TODO: FPU exceptions
 
+# At least on Windows the results of many complex functions are not conforming
+# to the C99 standard. See ticket 1574.
+functions_seem_flaky = (np.exp(complex(np.inf, 0)).imag != 0)
+# TODO: replace with a check on whether platform-provided C99 funcs are used
+have_platform_functions = (sys.platform == 'win32')
+skip_complex_tests = have_platform_functions and functions_seem_flaky
+
+def platform_skip(func):
+    return dec.skipif(skip_complex_tests,
+        "Numpy is using complex functions (e.g. sqrt) provided by your"
+        "platform's C library. However, they do not seem to behave according"
+        "to C99 -- so C99 tests are skipped.")(func)
+
+
 class TestCexp(object):
     def test_simple(self):
         check = check_complex_value
@@ -17,6 +33,7 @@
         ref = np.exp(1) * np.complex(np.cos(1), np.sin(1))
         yield check, f, 1, 1, ref.real, ref.imag, False
 
+    @platform_skip
     def test_special_values(self):
         # C99: Section G 6.3.1
 
@@ -127,6 +144,7 @@
         for i in range(len(x)):
             assert_almost_equal(y[i], y_r[i])
 
+    @platform_skip
     def test_special_values(self):
         xl = []
         yl = []
@@ -297,6 +315,7 @@
     #def test_branch_cut(self):
     #    _check_branch_cut(f, -1, 0, 1, -1)
 
+    @platform_skip
     def test_special_values(self):
         check = check_complex_value
         f = np.sqrt



More information about the Numpy-svn mailing list