mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +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
|
@ -313,7 +313,12 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
|||
"except Exception as e:\n"
|
||||
" raise ValueError from e\n")
|
||||
|
||||
def test_list_displays(self):
|
||||
self.check_expr('[]')
|
||||
self.check_expr('[*{2}, 3, *[4]]')
|
||||
|
||||
def test_set_displays(self):
|
||||
self.check_expr('{*{2}, 3, *[4]}')
|
||||
self.check_expr('{2}')
|
||||
self.check_expr('{2,}')
|
||||
self.check_expr('{2, 3}')
|
||||
|
@ -325,6 +330,13 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
|||
self.check_expr('{a:b,}')
|
||||
self.check_expr('{a:b, c:d}')
|
||||
self.check_expr('{a:b, c:d,}')
|
||||
self.check_expr('{**{}}')
|
||||
self.check_expr('{**{}, 3:4, **{5:6, 7:8}}')
|
||||
|
||||
def test_argument_unpacking(self):
|
||||
self.check_expr('f(a, *b, *c, *d)')
|
||||
self.check_expr('f(**a, **b)')
|
||||
self.check_expr('f(2, *a, *b, **b, **c, **d)')
|
||||
|
||||
def test_set_comprehensions(self):
|
||||
self.check_expr('{x for x in seq}')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue