-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
C: preview styleIssues with the preview and unstable style. Add the name of the responsible feature in the title.Issues with the preview and unstable style. Add the name of the responsible feature in the title.F: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working
Description
Describe the bug
With preview style, a long f-string where the only spaces are in the expression bit has parentheses added even though it isn't split over lines. For example:
f(
f'longstringwithnospacesinthestringbitbutwithspacesintheformattyfstringbithere{ 1 }',
)becomes
f(
(
f"longstringwithnospacesinthestringbitbutwithspacesintheformattyfstringbithere{ 1 }"
),
)I would instead expect it not to have changed. See on black playground
I noticed it also seems to occur with normal strings where the split is very near the start or end
f(
"l ongstringwithnospacesinthestringbitbutwithspacesintheformattyfstringbitherelollol",
)becomes
f(
(
"l ongstringwithnospacesinthestringbitbutwithspacesintheformattyfstringbitherelollol"
),
)See on black playground
Version
Black 23.1a1, with --preview
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C: preview styleIssues with the preview and unstable style. Add the name of the responsible feature in the title.Issues with the preview and unstable style. Add the name of the responsible feature in the title.F: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working