summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-08-19 21:32:38 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-08-19 21:32:38 (GMT)
commit12844e6df6d6ae2a8b51e6440b8b15b10a78949a (patch)
treed2e307d7388c73a02e500a0b51fa3ed979a2c38f /Lib/test
parent8101021eae574bc65952c0a0027ed9af67420a76 (diff)
downloadcpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.zip
cpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.tar.gz
cpython-12844e6df6d6ae2a8b51e6440b8b15b10a78949a.tar.bz2
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')
-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 be2a0a2..7117ef3 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