summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-29 01:02:14 (GMT)
committerGitHub <noreply@github.com>2021-07-29 01:02:14 (GMT)
commit405f5c54914483607194a3ba6d4e50533d92bad1 (patch)
tree5e729624453ffef239dc4c47c0e82c616213fa6b /Lib/test/test_ast.py
parentbccb7b9509e875ef23ec3225d03214ca047e5b1a (diff)
downloadcpython-405f5c54914483607194a3ba6d4e50533d92bad1.zip
cpython-405f5c54914483607194a3ba6d4e50533d92bad1.tar.gz
cpython-405f5c54914483607194a3ba6d4e50533d92bad1.tar.bz2
[3.10] bpo-43897: Reject "_" captures and top-level MatchStar in the AST validator (GH-27432) (GH-27435)
(cherry picked from commit 8d0647485db5af2a0f0929d6509479ca45f1281b) Co-authored-by: Brandt Bucher <brandt@python.org> Automerge-Triggered-By: GH:brandtbucher
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index ac0669a..326f3ab 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -1596,7 +1596,11 @@ class ASTValidatorTests(unittest.TestCase):
),
ast.MatchOr(
[pattern_1, pattern_x, ast.MatchSingleton('xxx')]
- )
+ ),
+ ast.MatchAs(name="_"),
+ ast.MatchStar(name="x"),
+ ast.MatchSequence([ast.MatchStar("_")]),
+ ast.MatchMapping([], [], rest="_"),
]
def test_match_validation_pattern(self):