diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-02-06 23:18:37 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-02-06 23:18:37 (GMT) |
commit | f57325392f01b2800063f755cd524ff7e4e44480 (patch) | |
tree | d5a7d89e1ce8bda77eee318d77312b63e824e55b | |
parent | f35c87631de0a5c24665bf0cf2ae53f46b6c0ba3 (diff) | |
download | cpython-f57325392f01b2800063f755cd524ff7e4e44480.zip cpython-f57325392f01b2800063f755cd524ff7e4e44480.tar.gz cpython-f57325392f01b2800063f755cd524ff7e4e44480.tar.bz2 |
Merged revisions 78045 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r78045 | mark.dickinson | 2010-02-06 23:16:50 +0000 (Sat, 06 Feb 2010) | 9 lines
Merged revisions 78041 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78041 | mark.dickinson | 2010-02-06 23:11:25 +0000 (Sat, 06 Feb 2010) | 1 line
testCopysign was defined twice in test_math; combine the definitions
........
................
-rw-r--r-- | Lib/test/test_math.py | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 2321a09..814b6af 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -211,31 +211,37 @@ class MathTests(unittest.TestCase): if float.__getformat__("double").startswith("IEEE"): 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) + self.assertRaises(TypeError, math.copysign) # copysign should let us distinguish signs of zeros - self.assertEquals(copysign(1., 0.), 1.) - self.assertEquals(copysign(1., -0.), -1.) - self.assertEquals(copysign(INF, 0.), INF) - self.assertEquals(copysign(INF, -0.), NINF) - self.assertEquals(copysign(NINF, 0.), INF) - self.assertEquals(copysign(NINF, -0.), NINF) + self.assertEquals(math.copysign(1., 0.), 1.) + self.assertEquals(math.copysign(1., -0.), -1.) + self.assertEquals(math.copysign(INF, 0.), INF) + self.assertEquals(math.copysign(INF, -0.), NINF) + self.assertEquals(math.copysign(NINF, 0.), INF) + self.assertEquals(math.copysign(NINF, -0.), NINF) # and of infinities - self.assertEquals(copysign(1., INF), 1.) - self.assertEquals(copysign(1., NINF), -1.) - self.assertEquals(copysign(INF, INF), INF) - self.assertEquals(copysign(INF, NINF), NINF) - self.assertEquals(copysign(NINF, INF), INF) - self.assertEquals(copysign(NINF, NINF), NINF) - self.assertTrue(math.isnan(copysign(NAN, 1.))) - self.assertTrue(math.isnan(copysign(NAN, INF))) - self.assertTrue(math.isnan(copysign(NAN, NINF))) - self.assertTrue(math.isnan(copysign(NAN, NAN))) + self.assertEquals(math.copysign(1., INF), 1.) + self.assertEquals(math.copysign(1., NINF), -1.) + self.assertEquals(math.copysign(INF, INF), INF) + self.assertEquals(math.copysign(INF, NINF), NINF) + self.assertEquals(math.copysign(NINF, INF), INF) + self.assertEquals(math.copysign(NINF, NINF), NINF) + self.assertTrue(math.isnan(math.copysign(NAN, 1.))) + self.assertTrue(math.isnan(math.copysign(NAN, INF))) + self.assertTrue(math.isnan(math.copysign(NAN, NINF))) + self.assertTrue(math.isnan(math.copysign(NAN, NAN))) # copysign(INF, NAN) may be INF or it may be NINF, since # we don't know whether the sign bit of NAN is set on any # given platform. - self.assertTrue(math.isinf(copysign(INF, NAN))) + self.assertTrue(math.isinf(math.copysign(INF, NAN))) # similarly, copysign(2., NAN) could be 2. or -2. - self.assertEquals(abs(copysign(2., NAN)), 2.) + self.assertEquals(abs(math.copysign(2., NAN)), 2.) def testCos(self): self.assertRaises(TypeError, math.cos) @@ -796,13 +802,6 @@ class MathTests(unittest.TestCase): #self.assertEquals((), math.trunc(t)) #self.assertRaises(TypeError, math.trunc, t, 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.assertTrue(math.isnan(float("nan"))) self.assertTrue(math.isnan(float("inf")* 0.)) |