diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-11-09 17:14:18 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-11-09 17:14:18 (GMT) |
commit | 94882db60fa09f2a2714cfd93ec1a53385b7b271 (patch) | |
tree | 29cb492dbc1ee269c4624040e3f64a90d85b8267 /Lib/test/test_builtin.py | |
parent | 959f3e50322467b9d894de67b118eb688753f9f1 (diff) | |
download | cpython-94882db60fa09f2a2714cfd93ec1a53385b7b271.zip cpython-94882db60fa09f2a2714cfd93ec1a53385b7b271.tar.gz cpython-94882db60fa09f2a2714cfd93ec1a53385b7b271.tar.bz2 |
Merged revisions 76177 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k
................
r76177 | mark.dickinson | 2009-11-09 17:12:30 +0000 (Mon, 09 Nov 2009) | 13 lines
Merged revisions 76176 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76176 | mark.dickinson | 2009-11-09 17:03:34 +0000 (Mon, 09 Nov 2009) | 7 lines
Issue #7251: Break out round tests for large values into a separate
test function, and skip that test on Linux/alpha systems with a broken
system round function.
This should turn the Debian/alpha buildbot green.
........
................
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index cac4555..f88a2d5d 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1,5 +1,6 @@ # Python test set -- built-in functions +import platform import test.support, unittest from test.support import fcmp, TESTFN, unlink, run_unittest, \ run_with_locale @@ -1123,6 +1124,27 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(TypeError, round, t) self.assertRaises(TypeError, round, t, 0) + # Some versions of glibc for alpha have a bug that affects + # float -> integer rounding (floor, ceil, rint, round) for + # values in the range [2**52, 2**53). See: + # + # http://sources.redhat.com/bugzilla/show_bug.cgi?id=5350 + # + # We skip this test on Linux/alpha if it would fail. + linux_alpha = (platform.system().startswith('Linux') and + platform.machine().startswith('alpha')) + system_round_bug = round(5e15+1) != 5e15+1 + @unittest.skipIf(linux_alpha and system_round_bug, + "test will fail; failure is probably due to a " + "buggy system round function") + def test_round_large(self): + # Issue #1869: integral floats should remain unchanged + self.assertEqual(round(5e15-1), 5e15-1) + self.assertEqual(round(5e15), 5e15) + self.assertEqual(round(5e15+1), 5e15+1) + self.assertEqual(round(5e15+2), 5e15+2) + self.assertEqual(round(5e15+3), 5e15+3) + def test_setattr(self): setattr(sys, 'spam', 1) self.assertEqual(sys.spam, 1) |