diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-08-19 19:52:46 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-08-19 19:52:46 (GMT) |
commit | 80f0ed5bb1b38a615d92bdf2b3b3dad854dd06d9 (patch) | |
tree | 3c75d17c436a3d9f6b8c9f8fa58b4ec6fa2badbe /Lib | |
parent | d9ccf8c547f3163946462fd382991b27d4d1a4ee (diff) | |
download | cpython-80f0ed5bb1b38a615d92bdf2b3b3dad854dd06d9.zip cpython-80f0ed5bb1b38a615d92bdf2b3b3dad854dd06d9.tar.gz cpython-80f0ed5bb1b38a615d92bdf2b3b3dad854dd06d9.tar.bz2 |
allow keyword args to be passed in after *args #3473
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_grammar.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index e749e44..f8cef6a 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -282,6 +282,14 @@ class GrammarTests(unittest.TestCase): def d32v((x,)): pass d32v((1,)) + # keyword arguments after *arglist + def f(*args, **kwargs): + return args, kwargs + self.assertEquals(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.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)") + # Check ast errors in *args and *kwargs check_syntax_error(self, "f(*g(1=2))") check_syntax_error(self, "f(**g(1=2))") |