diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-08-20 00:08:47 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-08-20 00:08:47 (GMT) |
commit | 67f24f1ed65d02511dbf2a9e219a78552566f71b (patch) | |
tree | b0bf92323c0883d551474237c077c4c2711a221a /Lib/test/test_compiler.py | |
parent | bd6a05fe81fe1573f0517ce8982d62341f3b0f85 (diff) | |
download | cpython-67f24f1ed65d02511dbf2a9e219a78552566f71b.zip cpython-67f24f1ed65d02511dbf2a9e219a78552566f71b.tar.gz cpython-67f24f1ed65d02511dbf2a9e219a78552566f71b.tar.bz2 |
follow-up of issue3473: update the compiler package to recognize the new syntax.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r-- | Lib/test/test_compiler.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py index 390c469..c7ec50f 100644 --- a/Lib/test/test_compiler.py +++ b/Lib/test/test_compiler.py @@ -64,6 +64,15 @@ class CompilerTest(unittest.TestCase): def testYieldExpr(self): compiler.compile("def g(): yield\n\n", "<string>", "exec") + def testKeywordAfterStarargs(self): + def f(*args, **kwargs): + self.assertEqual((args, kwargs), ((2,3), {'x': 1, 'y': 4})) + c = compiler.compile('f(x=1, *(2, 3), y=4)', '<string>', 'exec') + exec c in {'f': f} + + self.assertRaises(SyntaxError, compiler.parse, "foo(a=1, b)") + self.assertRaises(SyntaxError, compiler.parse, "foo(1, *args, 3)") + def testTryExceptFinally(self): # Test that except and finally clauses in one try stmt are recognized c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1", |