PEP 653: Delete out-of-date note and correct tests in mapping pattern translations. (#1895)

This commit is contained in:
Mark Shannon 2021-03-27 18:17:04 +00:00 committed by GitHub
parent 3686181865
commit 59b39a6dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -267,7 +267,7 @@ translates to::
if $kind & MATCH_MAPPING == 0: if $kind & MATCH_MAPPING == 0:
FAIL FAIL
if $value.keys() != $KEYWORD_PATTERNS.keys(): if not $value.keys() >= $KEYWORD_PATTERNS.keys():
FAIL FAIL
# $KEYWORD_PATTERNS is a meta-variable mapping names to variables. # $KEYWORD_PATTERNS is a meta-variable mapping names to variables.
for $KEYWORD in $KEYWORD_PATTERNS: for $KEYWORD in $KEYWORD_PATTERNS:
@ -283,7 +283,7 @@ translates to::
if $kind & MATCH_MAPPING == 0: if $kind & MATCH_MAPPING == 0:
FAIL FAIL
if $value.keys() not >= $KEYWORD_PATTERNS.keys(): if not $value.keys() >= $KEYWORD_PATTERNS.keys():
FAIL: FAIL:
# $KEYWORD_PATTERNS is a meta-variable mapping names to variables. # $KEYWORD_PATTERNS is a meta-variable mapping names to variables.
$tmp = dict($value) $tmp = dict($value)
@ -347,11 +347,6 @@ translates to::
Example: [6]_ Example: [6]_
.. note::
``__match_args__`` is not checked when matching positional-only class patterns,
this allows classes to match only positional-only patterns by leaving ``__match_args__`` set to the default value of ``None``.
Class patterns with all keyword patterns:: Class patterns with all keyword patterns::
case ClsName($KEYWORD_PATTERNS): case ClsName($KEYWORD_PATTERNS):