Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undesired line breaks when using multiple assignments #3854

Closed
yilei opened this issue Aug 24, 2023 · 1 comment
Closed

Undesired line breaks when using multiple assignments #3854

yilei opened this issue Aug 24, 2023 · 1 comment
Labels
F: linebreak How should we split up lines? T: bug Something isn't working

Comments

@yilei
Copy link
Contributor

yilei commented Aug 24, 2023

Black currently formats

zzzzzzzzzzzzzzzzzzzzzzzzzzz = zzzzzzzzzzzzzzzzzzzz = zzzzzzzzzzzzzzz = (
    "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
)

to:

zzzzzzzzzzzzzzzzzzzzzzzzzzz = (
    zzzzzzzzzzzzzzzzzzzz
) = zzzzzzzzzzzzzzz = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

Expected behavior

Black should favor using parenthesis and break on the right most side:

zzzzzzzzzzzzzzzzzzzzzzzzzzz = zzzzzzzzzzzzzzzzzzzz = zzzzzzzzzzzzzzz = (
    "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
)

Playground link

@yilei yilei added the T: bug Something isn't working label Aug 24, 2023
@JelleZijlstra JelleZijlstra added the F: linebreak How should we split up lines? label Aug 24, 2023
@MeGaGiGaGon
Copy link
Collaborator

This has been fixed and now formats correctly playground link. The fix was put into preview by #4010 and later stabilized in version 2024 as part of #3368. #4010 also added some roughly equivalent test cases here, so this should be good to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants