mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)
int(), bool(), float(), list() and tuple(). Specify the value as a positional argument instead.
This commit is contained in:
parent
d31b28e16a
commit
58d23e6806
12 changed files with 65 additions and 2 deletions
|
@ -246,9 +246,11 @@ class IntTestCases(unittest.TestCase):
|
|||
|
||||
def test_keyword_args(self):
|
||||
# Test invoking int() using keyword arguments.
|
||||
self.assertEqual(int(x=1.2), 1)
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
self.assertEqual(int(x=1.2), 1)
|
||||
self.assertEqual(int('100', base=2), 4)
|
||||
self.assertEqual(int(x='100', base=2), 4)
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
self.assertEqual(int(x='100', base=2), 4)
|
||||
self.assertRaises(TypeError, int, base=10)
|
||||
self.assertRaises(TypeError, int, base=0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue