From: Batuhan Taskaya Date: Fri, 3 Dec 2021 14:49:33 +0000 (+0300) Subject: Make star-expression spacing consistent in match/case (#2667) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/136930fccb99320865622e12ffc21bdd45fd7501?ds=inline Make star-expression spacing consistent in match/case (#2667) --- diff --git a/CHANGES.md b/CHANGES.md index fc198a8..e5f4a1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - Fix `match`/`case` statements that contain `match`/`case` soft keywords multiple times, like `match re.match()` (#2661) - Fix `case` statements with an inline body (#2665) +- Fix styling of starred expressions inside `match` subject (#2667) - Fix assignment to environment variables in Jupyter Notebooks (#2642) - Add `flake8-simplify` and `flake8-comprehensions` plugins (#2653) - Fix determination of f-string expression spans (#2654) diff --git a/src/black/nodes.py b/src/black/nodes.py index 437051d..8bf1934 100644 --- a/src/black/nodes.py +++ b/src/black/nodes.py @@ -97,6 +97,8 @@ UNPACKING_PARENTS: Final = { syms.listmaker, syms.testlist_gexp, syms.testlist_star_expr, + syms.subject_expr, + syms.pattern, } TEST_DESCENDANTS: Final = { syms.test, diff --git a/tests/data/pattern_matching_extras.py b/tests/data/pattern_matching_extras.py index 095c1a2..60ad8a3 100644 --- a/tests/data/pattern_matching_extras.py +++ b/tests/data/pattern_matching_extras.py @@ -77,3 +77,8 @@ match match( match match: case case: pass + + +match a, *b(), c: + case d, *f, g: + pass