From: Walter Dörwald Date: Tue, 15 Apr 2003 18:59:28 +0000 (+0000) Subject: Add a few errors tests for range(). X-Git-Tag: v2.3c1~1181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=357981e99ddd31009367bd61ac6b476212ee3612;p=python Add a few errors tests for range(). --- diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index dd718bf93d..3956214dbc 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -964,6 +964,12 @@ class BuiltinTest(unittest.TestCase): # (smaller floats still accepted, but deprecated) self.assertRaises(TypeError, range, 1e100, 1e101, 1e101) + self.assertRaises(TypeError, range, 0, "spam") + self.assertRaises(TypeError, range, 0, 42, "spam") + + self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint) + self.assertRaises(OverflowError, range, 0, 2*sys.maxint) + def test_input_and_raw_input(self): self.write_testfile() fp = open(TESTFN, 'r')