diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-12-09 21:49:48 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-12-09 21:49:48 (GMT) |
commit | 40d3a67a190ad1e1f49e123072abd7f4757fdf22 (patch) | |
tree | d1af05e91e318b9c8f6c1394f9eb688a929fb6a9 /Lib | |
parent | 3279b5df3c41f5a6a431e60dcca57cdcdb7808e3 (diff) | |
download | cpython-40d3a67a190ad1e1f49e123072abd7f4757fdf22.zip cpython-40d3a67a190ad1e1f49e123072abd7f4757fdf22.tar.gz cpython-40d3a67a190ad1e1f49e123072abd7f4757fdf22.tar.bz2 |
Issue #1573, second attempt:
"def f(*, **kw)" now raises a SyntaxError.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ast.py | 3 | ||||
-rw-r--r-- | Lib/test/test_keywordonlyarg.py | 8 |
2 files changed, 1 insertions, 10 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 03a877b..4883ed5 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -58,9 +58,6 @@ exec_tests = [ "break", # Continue "continue", - # kw only funcs - "def f(*, kw=1): pass", - "def f(*, **kw): pass", ] # These are compiled through "single" diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py index eeda547..e64a6cd 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -48,6 +48,7 @@ class KeywordOnlyArgTestCase(unittest.TestCase): self.assertRaisesSyntaxError("def f(p1, *, p1=100):\n pass\n") self.assertRaisesSyntaxError("def f(p1, *k1, k1=100):\n pass\n") self.assertRaisesSyntaxError("def f(p1, *, k1, k1=100):\n pass\n") + self.assertRaisesSyntaxError("def f(p1, *, **k1):\n pass\n") self.assertRaisesSyntaxError("def f(p1, *, k1, **k1):\n pass\n") self.assertRaisesSyntaxError("def f(p1, *, None, **k1):\n pass\n") self.assertRaisesSyntaxError("def f(p, *, (k1, k2), **kw):\n pass\n") @@ -144,13 +145,6 @@ class KeywordOnlyArgTestCase(unittest.TestCase): except TypeError: pass - def test_doublestar_only(self): - def f(*, **kw): - return kw - - self.assertEqual(f(), {}) - self.assertEqual(f(k1=1, k2=2), {'k1' : 1, 'k2' : 2}) - def test_kwonly_methods(self): class Example: def f(self, *, k1=1, k2=2): |