From: Batuhan Taskaya Date: Sun, 14 Nov 2021 14:04:31 +0000 (+0300) Subject: black/parser: support as-exprs within call args (#2608) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/147d075a4c702ffd6822100dc1f7a6384e52fa57?ds=inline black/parser: support as-exprs within call args (#2608) --- diff --git a/src/blib2to3/Grammar.txt b/src/blib2to3/Grammar.txt index 4968032..c2a6254 100644 --- a/src/blib2to3/Grammar.txt +++ b/src/blib2to3/Grammar.txt @@ -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 ) diff --git a/tests/data/pattern_matching_extras.py b/tests/data/pattern_matching_extras.py new file mode 100644 index 0000000..b17922d --- /dev/null +++ b/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) diff --git a/tests/test_format.py b/tests/test_format.py index 4359dee..8f8ffb3 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -73,6 +73,7 @@ EXPERIMENTAL_STRING_PROCESSING_CASES = [ PY310_CASES = [ "pattern_matching_simple", "pattern_matching_complex", + "pattern_matching_extras", "parenthesized_context_managers", ]