Black does not respect line length in case of long attribute chaining #1237
Labels
F: linetoolong
Black makes our lines too long
R: duplicate
This issue or pull request already exists
T: style
What do we want Blackened code to look like?
Describe the bug
In a case where there is code that chains a lot of attributes within a parentheses block (to avoid using backslashes) Black fails to respect the line length supplied to it.
To Reproduce
black . --diff -l 100
Expected behavior
The existing code in the block should be kept as it is (if it doesn't break any formatting rules otherwise) as it is probably a well thought out pattern by a developer or at least black should not put everything to the same line which exceeds the line-length (in this case the output line is 113 characters whereas the limit supplied to black is 100.)
Environment
Does this bug also happen on master?
Yes (Verified from the playground)
Additional context
As to where one might encounter this kind of block in real life, mocking and patching specific things in tests might get fairly nested (especially with
unittest
s.return_value
) or something like long ORM queries with SQLAlchemy.The text was updated successfully, but these errors were encountered: