diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-05-06 00:16:41 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-05-06 00:16:41 (GMT) |
commit | 025e9ebd0a0a19f50ca83af6ada0ac65be1fa2a1 (patch) | |
tree | d769adcb6d4a557a00923f18ed2b0ca8b515a473 /Lib/test/test_parser.py | |
parent | 4ccc1514d070cabe80e8cfa0469dc03c12d08be2 (diff) | |
download | cpython-025e9ebd0a0a19f50ca83af6ada0ac65be1fa2a1.zip cpython-025e9ebd0a0a19f50ca83af6ada0ac65be1fa2a1.tar.gz cpython-025e9ebd0a0a19f50ca83af6ada0ac65be1fa2a1.tar.bz2 |
PEP 448: additional unpacking generalizations (closes #2292)
Patch by Neil Girdhar.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r-- | Lib/test/test_parser.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 2112821..18f16e3 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -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}') |