summaryrefslogtreecommitdiff
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-08-19 21:32:38 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-08-19 21:32:38 +0000
commit12844e6df6d6ae2a8b51e6440b8b15b10a78949a (patch)
treed2e307d7388c73a02e500a0b51fa3ed979a2c38f /Lib/test/test_syntax.py
parent8101021eae574bc65952c0a0027ed9af67420a76 (diff)
downloadcpython-git-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.tar.gz
Add tests for r84209 (crashes in the Ast builder)
Also remove one tab, and move a check closer to the possible failure.
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index be2a0a28e9..7117ef3d8d 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -484,6 +484,34 @@ SyntaxError: can't delete ()
Traceback (most recent call last):
SyntaxError: can't assign to literal
+Corner-cases that used to fail to raise the correct error:
+
+ >>> def f(*, x=lambda __debug__:0): pass
+ Traceback (most recent call last):
+ SyntaxError: assignment to keyword
+
+ >>> def f(*args:(lambda __debug__:0)): pass
+ Traceback (most recent call last):
+ SyntaxError: assignment to keyword
+
+ >>> def f(**kwargs:(lambda __debug__:0)): pass
+ Traceback (most recent call last):
+ SyntaxError: assignment to keyword
+
+ >>> with (lambda *:0): pass
+ Traceback (most recent call last):
+ SyntaxError: named arguments must follow bare *
+
+Corner-cases that used to crash:
+
+ >>> def f(**__debug__): pass
+ Traceback (most recent call last):
+ SyntaxError: assignment to keyword
+
+ >>> def f(*xx, __debug__): pass
+ Traceback (most recent call last):
+ SyntaxError: assignment to keyword
+
"""
import re