-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
F: linetoolongBlack makes our lines too longBlack makes our lines too longT: bugSomething isn't workingSomething isn't working
Description
Describe the bug
A pattern matching pattern without parentheses does not get reformatted according to the line-length. This does get formatted if the pattern is surrounded by parentheses.
To Reproduce
The following should wrap the first pattern.
import enum
class AnimalEnumeration(enum.IntEnum):
ELEPHANT = 0
GIRAFFE = 1
AARDVARK = 2
GOLDFISH = 3
def match_animal():
x = AnimalEnumeration.ELEPHANT
match x:
case AnimalEnumeration.ELEPHANT | AnimalEnumeration.GIRAFFE | AnimalEnumeration.AARDVARK | AnimalEnumeration.GOLDFISH:
return True
case _:
return False
if __name__ == "__main__":
print(match_animal())`And run it with these arguments:
$ black file.py --target-version py310Expected behavior
I would expect this to get wrapped like a variable does.
case (
AnimalEnumeration.ELEPHANT
| AnimalEnumeration.GIRAFFE
| AnimalEnumeration.AARDVARK
| AnimalEnumeration.GOLDFISH
):
return TrueEnvironment
- Black's version: black, 22.10.1.dev24+gd4a8564 (compiled: no) (main)
- OS and Python version: Windows 10, Python (CPython) 3.10.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
F: linetoolongBlack makes our lines too longBlack makes our lines too longT: bugSomething isn't workingSomething isn't working