Operating system: macOS Sierra (10.12.6)
Python version: 3.7.0
Black version: 18.6b4
Does also happen on master: yes (but I also see one test failure on master so I might be doing this wrong)
Input file:
def myfn():
val = "string"
my_str_w_long_name = f"This is a string string string string string {val}"\
f"string string string string string {val}"
Output file:
def myfn():
val = "string"
my_str_w_long_name = f"This is a string string string string string {val}" f"string string string string string {val}"
Unexpected outcomes:
W391: blank line at end of fileOther observations:
\\ isn't there\Just adding my observation here.
I had a program equivalent to the following;
a = "<xml>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"<a>hello</a>"\
"</xml>"
when I ran black on it it produced this output;
a = "<xml>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "<a>hello</a>" "</xml>"
The output is 336 lines which is longer than pep8's 80 char limit or blacks' default 88 char limit.
And it looks really ugly.
For comparison:
When I ran autopep8 on the original, it left the file as is without any change.
When I ran yapf on the original, it left the file as is without any change.
I think black should also either;
a = ("<xml>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"<a>hello</a>"
"</xml>")
Yep, black should put those parenthesis there. We're going to fix this
Most helpful comment
Yep, black should put those parenthesis there. We're going to fix this