@@ -208,6 +208,41 @@ def test_3x_style_invalid_4(self):
208208 self .invalid_syntax ("raise E from" )
209209
210210
211+ # Modelled after Lib/test/test_grammar.py:TokenTests.test_funcdef issue2292
212+ # and Lib/test/text_parser.py test_list_displays, test_set_displays,
213+ # test_dict_displays, test_argument_unpacking, ... changes.
214+ class TestUnpackingGeneralizations (GrammarTest ):
215+ def test_mid_positional_star (self ):
216+ self .validate ("""func(1, *(2, 3), 4)""" )
217+
218+ def test_double_star_dict_literal (self ):
219+ self .validate ("""func(**{'eggs':'scrambled', 'spam':'fried'})""" )
220+
221+ def test_double_star_dict_literal_after_keywords (self ):
222+ self .validate ("""func(spam='fried', **{'eggs':'scrambled'})""" )
223+
224+ def test_list_display (self ):
225+ self .validate ("""[*{2}, 3, *[4]]""" )
226+
227+ def test_set_display (self ):
228+ self .validate ("""{*{2}, 3, *[4]}""" )
229+
230+ def test_dict_display_1 (self ):
231+ self .validate ("""{**{}}""" )
232+
233+ def test_dict_display_2 (self ):
234+ self .validate ("""{**{}, 3:4, **{5:6, 7:8}}""" )
235+
236+ def test_argument_unpacking_1 (self ):
237+ self .validate ("""f(a, *b, *c, d)""" )
238+
239+ def test_argument_unpacking_2 (self ):
240+ self .validate ("""f(**a, **b)""" )
241+
242+ def test_argument_unpacking_3 (self ):
243+ self .validate ("""f(2, *a, *b, **b, **c, **d)""" )
244+
245+
211246# Adapted from Python 3's Lib/test/test_grammar.py:GrammarTests.testFuncdef
212247class TestFunctionAnnotations (GrammarTest ):
213248 def test_1 (self ):
0 commit comments