From 78526013ffe64ddfa5dccdc736837f75a695cdc2 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 3 Jan 2008 22:32:26 +0000 Subject: Added copysign(x, y) function to the math module --- Lib/test/test_math.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lib/test/test_math.py') diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index d2da59bb96..f5bf1a3f98 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.)) -- cgit v1.2.1