-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
F: linetoolongBlack makes our lines too longBlack makes our lines too longS: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedThe changes in this design / enhancement issue have been accepted and can be implementedT: bugSomething isn't workingSomething isn't working
Description
Describe the bug
if
clauses in match
-case
blocks in are not reformatted when the line length is above the maximum length set.
To Reproduce
Take this code, where the second line is 99 characters (11 characters above the horizontal limit):
match "test":
case "test" if "any long condition" != "another long condition" and "this is a long condition":
print("Test")
And try formatting it:
$ black file.py
Black leaves the file unchanged:
All done! ✨ 🍰 ✨
1 file left unchanged.
Expected behavior
Black should reformat the file as:
match "test":
case "test" if (
"any long condition" != "another long condition" and "this is a long condition"
):
print("Test")
Environment
- Black's version: 23.7.0
- OS and Python version: Ubuntu Linux 22.04 (running on the Windows Subsystem for Linux) / Python 3.10.4
Additional context
This appears to happen regardless of the line length. Also, interestingly, if parentheses are added around the boolean expression manually, Black does format the file correctly.
Metadata
Metadata
Assignees
Labels
F: linetoolongBlack makes our lines too longBlack makes our lines too longS: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedThe changes in this design / enhancement issue have been accepted and can be implementedT: bugSomething isn't workingSomething isn't working