aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-06-10 23:50:32 +0100
committerGitHub <noreply@github.com>2021-06-10 23:50:32 +0100
commit05073036dcecefc00b0c3e7397601809da41e2f1 (patch)
treee6db253475a3b4bf1b446a2d12e90a0ea4a76043 /Lib/test/test_syntax.py
parente7b4644607789848f9752a3bd20ff216e25b4156 (diff)
downloadcpython-05073036dcecefc00b0c3e7397601809da41e2f1.tar.gz
cpython-05073036dcecefc00b0c3e7397601809da41e2f1.zip
bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 72e4ab15c87..e0d0445a83d 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1226,6 +1226,20 @@ Corner-cases that used to crash:
>>> import ä £
Traceback (most recent call last):
SyntaxError: invalid character '£' (U+00A3)
+
+ Invalid pattern matching constructs:
+
+ >>> match ...:
+ ... case 42 as _:
+ ... ...
+ Traceback (most recent call last):
+ SyntaxError: cannot use '_' as a target
+
+ >>> match ...:
+ ... case 42 as 1+2+4:
+ ... ...
+ Traceback (most recent call last):
+ SyntaxError: invalid pattern target
"""
import re