Preserve tuple parentheses in case patterns (#18147)

This commit is contained in:
Max Mynter
2025-05-22 07:52:21 +02:00
committed by GitHub
parent 01eeb2f0d6
commit bdf488462a
6 changed files with 86 additions and 18 deletions

View File

@@ -288,5 +288,13 @@ match x:
]:
pass
match a, b:
case [], []:
...
case [], _:
...
case _, []:
...
case _, _:
...

View File

@@ -0,0 +1,8 @@
# Ruff in some cases added brackets around tuples in some cases; deviating from Black.
# Ensure we don't revert already-applied formats with the fix.
# See https://github.com/astral-sh/ruff/pull/18147
match a, b:
case [[], []]:
...
case [[], _]:
...