summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
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 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