diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-28 07:42:11 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-28 07:42:11 (GMT) |
commit | 0b386d524765d875fd5f7b6150219e5e5cd69abf (patch) | |
tree | 685ff50538e96318e1f9384448e2b5a5aedfb302 /Lib/test/test_int.py | |
parent | 1e4bd53a34a46e44a5e88a6ecc5ea4f102b94b6f (diff) | |
download | cpython-0b386d524765d875fd5f7b6150219e5e5cd69abf.zip cpython-0b386d524765d875fd5f7b6150219e5e5cd69abf.tar.gz cpython-0b386d524765d875fd5f7b6150219e5e5cd69abf.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 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index 4f2224b..671b20a 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -226,6 +226,14 @@ class IntTestCases(unittest.TestCase): self.assertIs(int(b'10'), 10) self.assertIs(int(b'-1'), -1) + def test_keyword_args(self): + # Test invoking int() using keyword arguments. + self.assertEqual(int(x=1.2), 1) + self.assertEqual(int('100', base=2), 4) + self.assertEqual(int(x='100', base=2), 4) + self.assertRaises(TypeError, int, base=10) + self.assertRaises(TypeError, int, base=0) + def test_intconversion(self): # Test __int__() class ClassicMissingMethods: |