diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-11-24 10:54:58 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-11-24 10:54:58 (GMT) |
commit | bce783757ff5398280fc06efc2e0e951ec022d21 (patch) | |
tree | a993309641944c618f3b7f64f174f5b151f7307d /Lib | |
parent | 9dd5e16c5d8e7d9e7fa9c2fb1b2754df8161ab2b (diff) | |
download | cpython-bce783757ff5398280fc06efc2e0e951ec022d21.zip cpython-bce783757ff5398280fc06efc2e0e951ec022d21.tar.gz cpython-bce783757ff5398280fc06efc2e0e951ec022d21.tar.bz2 |
round(0, "ermintrude") succeeded instead of producing a TypeError. Fix this.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_float.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 573cc7e..4e918fb 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -367,6 +367,11 @@ class RoundTestCase(unittest.TestCase): self.assertEqual(round(-INF, n), -INF) self.assertTrue(math.isnan(round(NAN, n))) + self.assertRaises(TypeError, round, INF, 0.0) + self.assertRaises(TypeError, round, -INF, 1.0) + self.assertRaises(TypeError, round, NAN, "ceci n'est pas un integer") + self.assertRaises(TypeError, round, -0.0, 1j) + def test_large_n(self): for n in [324, 325, 400, 2**31-1, 2**31, 2**32, 2**100]: self.assertEqual(round(123.456, n), 123.456) |