bpo-43897: Reject "_" captures and top-level MatchStar in the AST validator (GH-27432)

This commit is contained in:
Brandt Bucher 2021-07-28 17:24:18 -07:00 committed by GitHub
parent 92b5dc780d
commit 8d0647485d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 21 deletions

View file

@ -1627,7 +1627,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):