-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?
Description
I'm not sure if this is a bug or feature, but it looks like a bug to me, or at least a super awkward behavior:
To Reproduce
Original lines:
assert my_data_size >= len(my_large_list), 'data size must be at least the length of my large data list'Black:
assert my_data_size >= len(
my_large_list
), "data size must be at least the length of my large data list"Expected behavior
The above formatting does not make any sense to me. It is very awkward and reduces readability considerably. This is the expected formatting:
assert my_data_size >= len(my_large_list), (
'data size must be at least the length of my large data list'
)In fact, I can hack the correct behavior by adding a manual break inside the assert error string:
Original file (hack)
assert my_data_size >= len(my_large_list), "data size must be at least" \
" the length of my large data list"Black:
assert my_data_size >= len(my_large_list), (
"data size must be at least" " the length of my large data list"
)Still, if I remove the space between the adjacent strings, Black reverts back to the above behavior. I have lots of assert statements in my code and this becomes a really serious problem.
Environment:
- Version: 19.10b0
- OS and Python version: same for Ubuntu and Mac. Python 3.7
Does this bug also happen on master? Yes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?