[Python-checkins] r86553 - in python/branches/py3k: Lib/test/cmath_testcases.txt Lib/test/test_cmath.py Misc/NEWS

mark.dickinson python-checkins at python.org
Sat Nov 20 12:08:28 CET 2010


Author: mark.dickinson
Date: Sat Nov 20 12:08:27 2010
New Revision: 86553

Log:
Issue #9920: Skip tests for cmath.atan and cmath.atanh applied to
complex zeros on systems where the log1p function fails to respect
the sign of zero.  This fixes a test failure on AIX.


Modified:
   python/branches/py3k/Lib/test/cmath_testcases.txt
   python/branches/py3k/Lib/test/test_cmath.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/test/cmath_testcases.txt
==============================================================================
--- python/branches/py3k/Lib/test/cmath_testcases.txt	(original)
+++ python/branches/py3k/Lib/test/cmath_testcases.txt	Sat Nov 20 12:08:27 2010
@@ -733,10 +733,11 @@
 ---------------------------
 
 -- zeros
-atan0000 atan 0.0 0.0 -> 0.0 0.0
-atan0001 atan 0.0 -0.0 -> 0.0 -0.0
-atan0002 atan -0.0 0.0 -> -0.0 0.0
-atan0003 atan -0.0 -0.0 -> -0.0 -0.0
+-- These are tested in testAtanSign in test_cmath.py
+-- atan0000 atan 0.0 0.0 -> 0.0 0.0
+-- atan0001 atan 0.0 -0.0 -> 0.0 -0.0
+-- atan0002 atan -0.0 0.0 -> -0.0 0.0
+-- atan0003 atan -0.0 -0.0 -> -0.0 -0.0
 
 -- values along both sides of imaginary axis
 atan0010 atan 0.0 -9.8813129168249309e-324 -> 0.0 -9.8813129168249309e-324
@@ -896,10 +897,11 @@
 ---------------------------------------
 
 -- zeros
-atanh0000 atanh 0.0 0.0 -> 0.0 0.0
-atanh0001 atanh 0.0 -0.0 -> 0.0 -0.0
-atanh0002 atanh -0.0 0.0 -> -0.0 0.0
-atanh0003 atanh -0.0 -0.0 -> -0.0 -0.0
+-- These are tested in testAtanhSign in test_cmath.py
+-- atanh0000 atanh 0.0 0.0 -> 0.0 0.0
+-- atanh0001 atanh 0.0 -0.0 -> 0.0 -0.0
+-- atanh0002 atanh -0.0 0.0 -> -0.0 0.0
+-- atanh0003 atanh -0.0 -0.0 -> -0.0 -0.0
 
 -- values along both sides of real axis
 atanh0010 atanh -9.8813129168249309e-324 0.0 -> -9.8813129168249309e-324 0.0

Modified: python/branches/py3k/Lib/test/test_cmath.py
==============================================================================
--- python/branches/py3k/Lib/test/test_cmath.py	(original)
+++ python/branches/py3k/Lib/test/test_cmath.py	Sat Nov 20 12:08:27 2010
@@ -514,6 +514,24 @@
         for z in complex_zeros:
             self.assertComplexIdentical(cmath.tanh(z), z)
 
+    # The algorithm used for atan and atanh makes use of the system
+    # log1p function; If that system function doesn't respect the sign
+    # of zero, then atan and atanh will also have difficulties with
+    # the sign of complex zeros.
+    @requires_IEEE_754
+    @unittest.skipIf(sysconfig.get_config_var('LOG1P_DROPS_ZERO_SIGN'),
+                     "system log1p() function doesn't preserve the sign")
+    def testAtanSign(self):
+        for z in complex_zeros:
+            self.assertComplexIdentical(cmath.atan(z), z)
+
+    @requires_IEEE_754
+    @unittest.skipIf(sysconfig.get_config_var('LOG1P_DROPS_ZERO_SIGN'),
+                     "system log1p() function doesn't preserve the sign")
+    def testAtanhSign(self):
+        for z in complex_zeros:
+            self.assertComplexIdentical(cmath.atanh(z), z)
+
 
 def test_main():
     run_unittest(CMathTests)

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Nov 20 12:08:27 2010
@@ -21,6 +21,10 @@
 Library
 -------
 
+- Issue #9920: Skip tests for cmath.atan and cmath.atanh applied to
+  complex zeros on systems where the log1p function fails to respect
+  the sign of zero.  This fixes a test failure on AIX.
+
 - Issue #10446: Module documentation generated by pydoc now links to a
   version-specific online reference manual.
 


More information about the Python-checkins mailing list