diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2007-07-26 14:03:00 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2007-07-26 14:03:00 (GMT) |
commit | 00f2029cd57ded3be287041b527c84cd8442afd5 (patch) | |
tree | f6a637e4848f7225feaeadcda6bc71bff6da605c /Lib/test | |
parent | c473149a5a93e4648b559023e5420b07e2832b4d (diff) | |
download | cpython-00f2029cd57ded3be287041b527c84cd8442afd5.zip cpython-00f2029cd57ded3be287041b527c84cd8442afd5.tar.gz cpython-00f2029cd57ded3be287041b527c84cd8442afd5.tar.bz2 |
Add explicit test for a misbehaving math.floor
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_math.py | 4 | ||||
-rw-r--r-- | Lib/test/test_pow.py | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index a45fc34..699c621 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -92,6 +92,10 @@ class MathTests(unittest.TestCase): self.ftest('floor(-0.5)', math.floor(-0.5), -1) self.ftest('floor(-1.0)', math.floor(-1.0), -1) self.ftest('floor(-1.5)', math.floor(-1.5), -2) + # pow() relies on floor() to check for integers + # This fails on some platforms - so check it here + self.ftest('floor(1.23e167)', math.floor(1.23e167), 1.23e167) + self.ftest('floor(-1.23e167)', math.floor(-1.23e167), -1.23e167) def testFmod(self): self.assertRaises(TypeError, math.fmod) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index c4aeb19..361a475 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -106,12 +106,9 @@ class PowTest(unittest.TestCase): # platform pow() was buggy, and Python didn't worm around it. eq = self.assertEquals a = -1.0 - # XXX Temporary diagnostic for failure on alpha Debian buildbot - from sys import __stdout__ - from math import floor - print >> __stdout__, "*** Number: %r" % 1.23e167 - print >> __stdout__, "*** Floor: %r" % floor(1.23e167) - # XXX End diagnostic message + # The next two tests can still fail if the platform floor() + # function doesn't treat all large inputs as integers + # test_math should also fail if that is happening eq(pow(a, 1.23e167), 1.0) eq(pow(a, -1.23e167), 1.0) for b in range(-10, 11): |