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.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index de783f7..b978838 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1213,6 +1213,22 @@ Missing parens after function definition
Traceback (most recent call last):
SyntaxError: expected '('
+ >>> def f -> int:
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
+ >>> async def f -> int: # type: int
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
+ >>> async def f[T]:
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
+ >>> def f[T] -> str:
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
Parenthesized arguments in function definitions
>>> def f(x, (y, z), w):
@@ -2027,6 +2043,31 @@ Invalid bytes literals:
Invalid expressions in type scopes:
+ >>> type A[] = int
+ Traceback (most recent call last):
+ ...
+ SyntaxError: Type parameter list cannot be empty
+
+ >>> class A[]: ...
+ Traceback (most recent call last):
+ ...
+ SyntaxError: Type parameter list cannot be empty
+
+ >>> def some[](): ...
+ Traceback (most recent call last):
+ ...
+ SyntaxError: Type parameter list cannot be empty
+
+ >>> def some[]()
+ Traceback (most recent call last):
+ ...
+ SyntaxError: Type parameter list cannot be empty
+
+ >>> async def some[]: # type: int
+ Traceback (most recent call last):
+ ...
+ SyntaxError: Type parameter list cannot be empty
+
>>> type A[T: (x:=3)] = int
Traceback (most recent call last):
...