summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-05-26 20:07:58 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-05-26 20:07:58 (GMT)
commitf9a5a8e0aff67061583b31afa114a6d025b1680d (patch)
treeebfb85fbd8c7e1f794a0b8ab5010d49446a0f7f7 /Lib
parentd5442cd37a391052723113e10f61a51da48f749e (diff)
downloadcpython-f9a5a8e0aff67061583b31afa114a6d025b1680d.zip
cpython-f9a5a8e0aff67061583b31afa114a6d025b1680d.tar.gz
cpython-f9a5a8e0aff67061583b31afa114a6d025b1680d.tar.bz2
Issue #2844: Make int('42', n) consistently raise ValueError for
invalid integers n (including n = -909).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_long.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index c47b8e3..133702e 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -345,6 +345,16 @@ class LongTest(unittest.TestCase):
self.assertRaises(ValueError, int, '08', 0)
self.assertRaises(ValueError, int, '-012395', 0)
+ # invalid bases
+ invalid_bases = [-909,
+ 2**31-1, 2**31, -2**31, -2**31-1,
+ 2**63-1, 2**63, -2**63, -2**63-1,
+ 2**100, -2**100,
+ ]
+ for base in invalid_bases:
+ self.assertRaises(ValueError, int, '42', base)
+
+
def test_conversion(self):
class JustLong: