You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Black is not able to reliably format code with assert and certain length string with formatting.
This happens with both 19.10b0 and the current master 19.10b1.dev154+gcd3a93a.d20200822.
19.3b0 does not have the issue.
--- source
+++ first pass
@@ -1,4 +1,6 @@
-assert some_type_of_boolean_expression, (
- "format-string-and-arguments with certain total length %s %s xxxxx"
- % (xxxxxxxxx, xxx)
+assert (
+ some_type_of_boolean_expression
+), "format-string-and-arguments with certain total length %s %s xxxxx" % (
+ xxxxxxxxx,
+ xxx,
)
--- first pass
+++ second pass
@@ -1,6 +1,4 @@
-assert (
- some_type_of_boolean_expression
-), "format-string-and-arguments with certain total length %s %s xxxxx" % (
- xxxxxxxxx,
- xxx,
+assert some_type_of_boolean_expression, (
+ "format-string-and-arguments with certain total length %s %s xxxxx"
+ % (xxxxxxxxx, xxx,)
)
Some additional notes:
If I remove one x, black reliably gives me output:
assert (
some_type_of_boolean_expression
), "format-string-and-arguments with certain total length %s %s xxxx" % (xxxxxxxxx, xxx)
Anyway, here the longest line is 88 chars so this format can not be used with the original code.
On the other hand, if I add one X to the original code, black again works and gives me format:
assert some_type_of_boolean_expression, (
"format-string-and-arguments with certain total length %s %s xxxxxX"
% (xxxxxxxxx, xxx)
This is a format that could be used with the original code.
And this seems to be same format than output of the first pass.
Finally, black uses this same format if I add a trailing comma to the string format arguments:
assert some_type_of_boolean_expression, (
"format-string-and-arguments with certain total length %s %s xxxxx"
% (xxxxxxxxx, xxx,)
)
But I wonder is this against the "magical trailing comma" rule?
The text was updated successfully, but these errors were encountered:
(black-rHKUX7ap) R:\Programming\black>type temp.pyassert some_type_of_boolean_expression, ( "format-string-and-arguments with certain total length %s %s xxxxx" % (xxxxxxxxx, xxx))(black-rHKUX7ap) R:\Programming\black>git checkout cd3a93aHEAD is now at cd3a93a Property-based fuzz test(black-rHKUX7ap) R:\Programming\black>black temp.py --checkerror: cannot format temp.py: INTERNAL ERROR: Black produced different code on the second pass of the formatter. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: C:\Users\User\AppData\Local\Temp\blk_7487p0vh.logOh no! 💥 💔 💥1 file would fail to reformat.(black-rHKUX7ap) R:\Programming\black>git checkout 586d24236e6b57bc3b5da85fdbe2563835021076Previous HEAD position was cd3a93a Property-based fuzz testHEAD is now at 586d242 Address pre-existing trailing commas when not in the rightmost bracket pair(black-rHKUX7ap) R:\Programming\black>black temp.py --checkwould reformat temp.pyOh no! 💥 💔 💥1 file would be reformatted.
Black is not able to reliably format code with assert and certain length string with formatting.
This happens with both 19.10b0 and the current master 19.10b1.dev154+gcd3a93a.d20200822.
19.3b0 does not have the issue.
Some additional notes:
If I remove one x, black reliably gives me output:
Anyway, here the longest line is 88 chars so this format can not be used with the original code.
On the other hand, if I add one X to the original code, black again works and gives me format:
This is a format that could be used with the original code.
And this seems to be same format than output of the first pass.
Finally, black uses this same format if I add a trailing comma to the string format arguments:
But I wonder is this against the "magical trailing comma" rule?
The text was updated successfully, but these errors were encountered: