summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-03 22:32:26 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-03 22:32:26 (GMT)
commiteebb79cc690e8ab02cb7f630cfbc046df2c0f4da (patch)
treee6eae18d02015f5adb8535f3b69cf33e1ba9eb51 /Lib/test
parent000a074c955a1964959ee908300ef49b41170a06 (diff)
downloadcpython-eebb79cc690e8ab02cb7f630cfbc046df2c0f4da.zip
cpython-eebb79cc690e8ab02cb7f630cfbc046df2c0f4da.tar.gz
cpython-eebb79cc690e8ab02cb7f630cfbc046df2c0f4da.tar.bz2
Added copysign(x, y) function to the math module
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_math.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index d2da59b..f5bf1a3 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -229,6 +229,13 @@ class MathTests(unittest.TestCase):
self.ftest('tanh(0)', math.tanh(0), 0)
self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0)
+ def testCopysign(self):
+ self.assertEqual(math.copysign(1, 42), 1.0)
+ self.assertEqual(math.copysign(0., 42), 0.0)
+ self.assertEqual(math.copysign(1., -42), -1.0)
+ self.assertEqual(math.copysign(3, 0.), 3.0)
+ self.assertEqual(math.copysign(4., -0.), -4.0)
+
def testIsnan(self):
self.assert_(math.isnan(float("nan")))
self.assert_(math.isnan(float("inf")* 0.))