From: Mark Dickinson Date: Wed, 26 May 2010 19:18:28 +0000 (+0000) Subject: Merged revisions 81553 via svnmerge from X-Git-Tag: v3.1.3rc1~702 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66f07cec30de8561bd3b253061123623122658e6;p=python 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). ........ ................ --- diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 1b5e6d4c9b..a596cf84ea 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__()