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.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 47df057..24233b2 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -825,6 +825,24 @@ leading to spurious errors.
Traceback (most recent call last):
SyntaxError: expected ':'
+ >>> match x
+ ... case list():
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: expected ':'
+
+ >>> match x:
+ ... case list()
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: expected ':'
+
+ >>> match x:
+ ... case [y] if y > 0
+ ... pass
+ Traceback (most recent call last):
+ SyntaxError: expected ':'
+
Make sure that the old "raise X, Y[, Z]" form is gone:
>>> raise X, Y
Traceback (most recent call last):
@@ -1159,6 +1177,24 @@ def func2():
for paren in ")]}":
self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+ def test_match_call_does_not_raise_syntax_error(self):
+ code = """
+def match(x):
+ return 1+1
+
+match(34)
+"""
+ compile(code, "<string>", "exec")
+
+ def test_case_call_does_not_raise_syntax_error(self):
+ code = """
+def case(x):
+ return 1+1
+
+case(34)
+"""
+ compile(code, "<string>", "exec")
+
def test_main():
support.run_unittest(SyntaxTestCase)