diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-28 08:02:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-28 08:02:42 (GMT) |
commit | 00e284311565c2caeadd10faa75cbe261b71bdaf (patch) | |
tree | 7146794182c585f8cb1f0a12049f5074c8035503 /Lib/test/test_int.py | |
parent | 28441e353cbe95e1b2e26eb08d7b1969ca26d261 (diff) | |
parent | 0b386d524765d875fd5f7b6150219e5e5cd69abf (diff) | |
download | cpython-00e284311565c2caeadd10faa75cbe261b71bdaf.zip cpython-00e284311565c2caeadd10faa75cbe261b71bdaf.tar.gz cpython-00e284311565c2caeadd10faa75cbe261b71bdaf.tar.bz2 |
Issue #16761: Raise TypeError when int() called with base argument only.
Diffstat (limited to 'Lib/test/test_int.py')
-rw-r--r-- | Lib/test/test_int.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index 52705de..c35a42f 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -233,16 +233,8 @@ class IntTestCases(unittest.TestCase): self.assertEqual(int(x=1.2), 1) self.assertEqual(int('100', base=2), 4) self.assertEqual(int(x='100', base=2), 4) - - # For example, PyPy 1.9.0 raised TypeError for these cases because it - # expects x to be a string if base is given. - @support.cpython_only - def test_base_arg_with_no_x_arg(self): - self.assertEqual(int(base=6), 0) - # Even invalid bases don't raise an exception. - self.assertEqual(int(base=1), 0) - self.assertEqual(int(base=1000), 0) - self.assertEqual(int(base='foo'), 0) + self.assertRaises(TypeError, int, base=10) + self.assertRaises(TypeError, int, base=0) def test_non_numeric_input_types(self): # Test possible non-numeric types for the argument x, including |