[3.10] bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632) (GH-26792)
(cherry picked from commit 05073036dcecefc00b0c3e7397601809da41e2f1)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 72e4ab1..e0d0445 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1226,6 +1226,20 @@
>>> 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