|
18 | 18 |
|
19 | 19 | D4 = {"A long and ridiculous {}".format(string_key): "This is a really really really long string that has to go i,side of a dictionary. It is soooo bad.", some_func("calling", "some", "stuff"): "This is a really really really long string that has to go inside of a dictionary. It is {soooo} bad (#{x}).".format(sooo="soooo", x=2), "A %s %s" % ("formatted", "string"): "This is a really really really long string that has to go inside of a dictionary. It is %s bad (#%d)." % ("soooo", 2)}
|
20 | 20 |
|
| 21 | +L1 = ["The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a list literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a list literal.", ("parens should be stripped for short string in list")] |
| 22 | + |
| 23 | +L2 = ["This is a really long string that can't be expected to fit in one line and is the only child of a list literal."] |
| 24 | + |
| 25 | +S1 = {"The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a set literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a set literal.", ("parens should be stripped for short string in set")} |
| 26 | + |
| 27 | +S2 = {"This is a really long string that can't be expected to fit in one line and is the only child of a set literal."} |
| 28 | + |
| 29 | +T1 = ("The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a tuple literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a tuple literal.", ("parens should be stripped for short string in list")) |
| 30 | + |
| 31 | +T2 = ("This is a really long string that can't be expected to fit in one line and is the only child of a tuple literal.",) |
| 32 | + |
21 | 33 | func_with_keywords(my_arg, my_kwarg="Long keyword strings also need to be wrapped, but they will probably need to be handled a little bit differently.")
|
22 | 34 |
|
23 | 35 | bad_split1 = (
|
|
109 | 121 |
|
110 | 122 | comment_string = "Long lines with inline comments should have their comments appended to the reformatted string's enclosing right parentheses." # This comment gets thrown to the top.
|
111 | 123 |
|
112 |
| -arg_comment_string = print("Long lines with inline comments which are apart of (and not the only member of) an argument list should have their comments appended to the reformatted string's enclosing left parentheses.", # This comment stays on the bottom. |
| 124 | +arg_comment_string = print("Long lines with inline comments which are apart of (and not the only member of) an argument list should have their comments appended to the reformatted string's enclosing left parentheses.", # This comment gets thrown to the top. |
113 | 125 | "Arg #2", "Arg #3", "Arg #4", "Arg #5")
|
114 | 126 |
|
115 | 127 | pragma_comment_string1 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone." # noqa: E501
|
@@ -345,6 +357,71 @@ def foo():
|
345 | 357 | % ("soooo", 2),
|
346 | 358 | }
|
347 | 359 |
|
| 360 | +L1 = [ |
| 361 | + "The is a short string", |
| 362 | + ( |
| 363 | + "This is a really long string that can't possibly be expected to fit all" |
| 364 | + " together on one line. Also it is inside a list literal, so it's expected to" |
| 365 | + " be wrapped in parens when spliting to avoid implicit str concatenation." |
| 366 | + ), |
| 367 | + short_call("arg", {"key": "value"}), |
| 368 | + ( |
| 369 | + "This is another really really (not really) long string that also can't be" |
| 370 | + " expected to fit on one line and is, like the other string, inside a list" |
| 371 | + " literal." |
| 372 | + ), |
| 373 | + "parens should be stripped for short string in list", |
| 374 | +] |
| 375 | + |
| 376 | +L2 = [ |
| 377 | + "This is a really long string that can't be expected to fit in one line and is the" |
| 378 | + " only child of a list literal." |
| 379 | +] |
| 380 | + |
| 381 | +S1 = { |
| 382 | + "The is a short string", |
| 383 | + ( |
| 384 | + "This is a really long string that can't possibly be expected to fit all" |
| 385 | + " together on one line. Also it is inside a set literal, so it's expected to be" |
| 386 | + " wrapped in parens when spliting to avoid implicit str concatenation." |
| 387 | + ), |
| 388 | + short_call("arg", {"key": "value"}), |
| 389 | + ( |
| 390 | + "This is another really really (not really) long string that also can't be" |
| 391 | + " expected to fit on one line and is, like the other string, inside a set" |
| 392 | + " literal." |
| 393 | + ), |
| 394 | + "parens should be stripped for short string in set", |
| 395 | +} |
| 396 | + |
| 397 | +S2 = { |
| 398 | + "This is a really long string that can't be expected to fit in one line and is the" |
| 399 | + " only child of a set literal." |
| 400 | +} |
| 401 | + |
| 402 | +T1 = ( |
| 403 | + "The is a short string", |
| 404 | + ( |
| 405 | + "This is a really long string that can't possibly be expected to fit all" |
| 406 | + " together on one line. Also it is inside a tuple literal, so it's expected to" |
| 407 | + " be wrapped in parens when spliting to avoid implicit str concatenation." |
| 408 | + ), |
| 409 | + short_call("arg", {"key": "value"}), |
| 410 | + ( |
| 411 | + "This is another really really (not really) long string that also can't be" |
| 412 | + " expected to fit on one line and is, like the other string, inside a tuple" |
| 413 | + " literal." |
| 414 | + ), |
| 415 | + "parens should be stripped for short string in list", |
| 416 | +) |
| 417 | + |
| 418 | +T2 = ( |
| 419 | + ( |
| 420 | + "This is a really long string that can't be expected to fit in one line and is" |
| 421 | + " the only child of a tuple literal." |
| 422 | + ), |
| 423 | +) |
| 424 | + |
348 | 425 | func_with_keywords(
|
349 | 426 | my_arg,
|
350 | 427 | my_kwarg=(
|
@@ -487,7 +564,7 @@ def foo():
|
487 | 564 | arg_comment_string = print(
|
488 | 565 | "Long lines with inline comments which are apart of (and not the only member of) an"
|
489 | 566 | " argument list should have their comments appended to the reformatted string's"
|
490 |
| - " enclosing left parentheses.", # This comment stays on the bottom. |
| 567 | + " enclosing left parentheses.", # This comment gets thrown to the top. |
491 | 568 | "Arg #2",
|
492 | 569 | "Arg #3",
|
493 | 570 | "Arg #4",
|
|
0 commit comments