summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-04-15 18:59:28 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-04-15 18:59:28 (GMT)
commit357981e99ddd31009367bd61ac6b476212ee3612 (patch)
tree8774862bd9c1fd5a615a54b2e5b5f7faea25fb4a
parent64976e74af6a1ad11381f7688d5bf80aad65bc73 (diff)
downloadcpython-357981e99ddd31009367bd61ac6b476212ee3612.zip
cpython-357981e99ddd31009367bd61ac6b476212ee3612.tar.gz
cpython-357981e99ddd31009367bd61ac6b476212ee3612.tar.bz2
Add a few errors tests for range().
-rw-r--r--Lib/test/test_builtin.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index dd718bf..3956214 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')