Skip to content

Commit

Permalink
black/parser: support as-exprs within call args (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
isidentical committed Nov 14, 2021
1 parent eb9d039 commit 147d075
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/blib2to3/Grammar.txt
Expand Up @@ -186,6 +186,7 @@ arglist: argument (',' argument)* [',']
# that precede iterable unpackings are blocked; etc.
argument: ( test [comp_for] |
test ':=' test |
test 'as' test |
test '=' test |
'**' test |
'*' test )
Expand Down
9 changes: 9 additions & 0 deletions tests/data/pattern_matching_extras.py
@@ -0,0 +1,9 @@
match something:
case [a as b]:
print(b)
case [a as b, c, d, e as f]:
print(f)
case Point(a as b):
print(b)
case Point(int() as x, int() as y):
print(x, y)
1 change: 1 addition & 0 deletions tests/test_format.py
Expand Up @@ -73,6 +73,7 @@
PY310_CASES = [
"pattern_matching_simple",
"pattern_matching_complex",
"pattern_matching_extras",
"parenthesized_context_managers",
]

Expand Down

0 comments on commit 147d075

Please sign in to comment.