mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
PEP 448: additional unpacking generalizations (closes #2292)
Patch by Neil Girdhar.
This commit is contained in:
parent
4ccc1514d0
commit
025e9ebd0a
26 changed files with 2664 additions and 2118 deletions
|
@ -296,8 +296,12 @@ class GrammarTests(unittest.TestCase):
|
|||
return args, kwargs
|
||||
self.assertEqual(f(1, x=2, *[3, 4], y=5), ((1, 3, 4),
|
||||
{'x':2, 'y':5}))
|
||||
self.assertRaises(SyntaxError, eval, "f(1, *(2,3), 4)")
|
||||
self.assertEqual(f(1, *(2,3), 4), ((1, 2, 3, 4), {}))
|
||||
self.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)")
|
||||
self.assertEqual(f(**{'eggs':'scrambled', 'spam':'fried'}),
|
||||
((), {'eggs':'scrambled', 'spam':'fried'}))
|
||||
self.assertEqual(f(spam='fried', **{'eggs':'scrambled'}),
|
||||
((), {'eggs':'scrambled', 'spam':'fried'}))
|
||||
|
||||
# argument annotation tests
|
||||
def f(x) -> list: pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue