aboutsummaryrefslogtreecommitdiffstatshomepage
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.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index f41df8ca49a..28414ba5949 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -909,6 +909,44 @@ Missing parens after function definition
Traceback (most recent call last):
SyntaxError: expected '('
+Parenthesized arguments in function definitions
+
+ >>> def f(x, (y, z), w):
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: Function parameters cannot be parenthesized
+
+ >>> def f((x, y, z, w)):
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: Function parameters cannot be parenthesized
+
+ >>> def f(x, (y, z, w)):
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: Function parameters cannot be parenthesized
+
+ >>> def f((x, y, z), w):
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: Function parameters cannot be parenthesized
+
+ >>> lambda x, (y, z), w: None
+ Traceback (most recent call last):
+ SyntaxError: Lambda expression parameters cannot be parenthesized
+
+ >>> lambda (x, y, z, w): None
+ Traceback (most recent call last):
+ SyntaxError: Lambda expression parameters cannot be parenthesized
+
+ >>> lambda x, (y, z, w): None
+ Traceback (most recent call last):
+ SyntaxError: Lambda expression parameters cannot be parenthesized
+
+ >>> lambda (x, y, z), w: None
+ Traceback (most recent call last):
+ SyntaxError: Lambda expression parameters cannot be parenthesized
+
Custom error messages for try blocks that are not followed by except/finally
>>> try: