diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-05-26 19:18:28 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-05-26 19:18:28 (GMT) |
commit | 66f07cec30de8561bd3b253061123623122658e6 (patch) | |
tree | aa9f7ff4a2a4a65173c781fb03283148608a2aab | |
parent | 9c9d878b3a65c33a13ebb96221db8578841126f3 (diff) | |
download | cpython-66f07cec30de8561bd3b253061123623122658e6.zip cpython-66f07cec30de8561bd3b253061123623122658e6.tar.gz cpython-66f07cec30de8561bd3b253061123623122658e6.tar.bz2 |
Merged revisions 81553 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81553 | mark.dickinson | 2010-05-26 20:14:01 +0100 (Wed, 26 May 2010) | 9 lines
Merged revisions 81551 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81551 | mark.dickinson | 2010-05-26 20:06:33 +0100 (Wed, 26 May 2010) | 1 line
Issue #8825: additional testcases for int(string, 0) and long(string, 0).
........
................
-rw-r--r-- | Lib/test/test_long.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 1b5e6d4..a596cf8 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -404,6 +404,20 @@ class LongTest(unittest.TestCase): self.assertEqual(int('2br45qc', 35), 4294967297) self.assertEqual(int('1z141z5', 36), 4294967297) + # tests with base 0 + self.assertEqual(int('000', 0), 0) + self.assertEqual(int('0o123', 0), 83) + self.assertEqual(int('0x123', 0), 291) + self.assertEqual(int('0b100', 0), 4) + self.assertEqual(int(' 0O123 ', 0), 83) + self.assertEqual(int(' 0X123 ', 0), 291) + self.assertEqual(int(' 0B100 ', 0), 4) + self.assertEqual(int('0', 0), 0) + self.assertEqual(int('+0', 0), 0) + self.assertEqual(int('-0', 0), 0) + self.assertEqual(int('00', 0), 0) + self.assertRaises(ValueError, int, '08', 0) + self.assertRaises(ValueError, int, '-012395', 0) def test_conversion(self): # Test __int__() |