]> git.madduck.net Git - etc/vim.git/blob - tests/data/preview/long_strings.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

9288b253b60e4c1950af3b0368a18861745bc281
[etc/vim.git] / tests / data / preview / long_strings.py
1 x = "This is a really long string that can't possibly be expected to fit all together on one line. In fact it may even take up three or more lines... like four or five... but probably just three."
2
3 x += "This is a really long string that can't possibly be expected to fit all together on one line. In fact it may even take up three or more lines... like four or five... but probably just three."
4
5 y = (
6     'Short string'
7 )
8
9 print('This is a really long string inside of a print statement with extra arguments attached at the end of it.', x, y, z)
10
11 print("This is a really long string inside of a print statement with no extra arguments attached at the end of it.")
12
13 D1 = {"The First": "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a dictionary, so formatting is more difficult.", "The Second": "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 dictionary."}
14
15 D2 = {1.0: "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a dictionary, so formatting is more difficult.", 2.0: "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 dictionary."}
16
17 D3 = {x: "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a dictionary, so formatting is more difficult.", y: "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 dictionary."}
18
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
21 D5 = {  # Test for https://github.com/psf/black/issues/3261
22     ("This is a really long string that can't be expected to fit in one line and is used as a nested dict's key"): {"inner": "value"},
23 }
24
25 D6 = {  # Test for https://github.com/psf/black/issues/3261
26     ("This is a really long string that can't be expected to fit in one line and is used as a dict's key"): ["value1", "value2"],
27 }
28
29 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")]
30
31 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."]
32
33 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")}
34
35 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."}
36
37 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"))
38
39 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.",)
40
41 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.")
42
43 bad_split1 = (
44     'But what should happen when code has already been formatted but in the wrong way? Like'
45     " with a space at the end instead of the beginning. Or what about when it is split too soon?"
46 )
47
48 bad_split2 = "But what should happen when code has already " \
49              "been formatted but in the wrong way? Like " \
50              "with a space at the end instead of the " \
51              "beginning. Or what about when it is split too " \
52              "soon? In the case of a split that is too " \
53              "short, black will try to honer the custom " \
54              "split."
55
56 bad_split3 = (
57     "What if we have inline comments on "  # First Comment
58     "each line of a bad split? In that "  # Second Comment
59     "case, we should just leave it alone."  # Third Comment
60 )
61
62 bad_split_func1(
63     "But what should happen when code has already "
64     "been formatted but in the wrong way? Like "
65     "with a space at the end instead of the "
66     "beginning. Or what about when it is split too "
67     "soon? In the case of a split that is too "
68     "short, black will try to honer the custom "
69     "split.",
70     xxx, yyy, zzz
71 )
72
73 bad_split_func2(
74     xxx, yyy, zzz,
75     long_string_kwarg="But what should happen when code has already been formatted but in the wrong way? Like "
76                       "with a space at the end instead of the beginning. Or what about when it is split too "
77                       "soon?",
78 )
79
80 bad_split_func3(
81     (
82         "But what should happen when code has already "
83         r"been formatted but in the wrong way? Like "
84         "with a space at the end instead of the "
85         r"beginning. Or what about when it is split too "
86         r"soon? In the case of a split that is too "
87         "short, black will try to honer the custom "
88         "split."
89     ),
90     xxx,
91     yyy,
92     zzz,
93 )
94
95 inline_comments_func1(
96     "if there are inline "
97     "comments in the middle "
98     # Here is the standard alone comment.
99     "of the implicitly concatenated "
100     "string, we should handle "
101     "them correctly",
102     xxx,
103 )
104
105 inline_comments_func2(
106     "what if the string is very very very very very very very very very very long and this part does "
107     "not fit into a single line? "
108     # Here is the standard alone comment.
109     "then the string should still be properly handled by merging and splitting "
110     "it into parts that fit in line length.",
111     xxx,
112 )
113
114 raw_string = r"This is a long raw string. When re-formatting this string, black needs to make sure it prepends the 'r' onto the new string."
115
116 fmt_string1 = "We also need to be sure to preserve any and all {} which may or may not be attached to the string in question.".format("method calls")
117
118 fmt_string2 = "But what about when the string is {} but {}".format("short", "the method call is really really really really really really really really long?")
119
120 old_fmt_string1 = "While we are on the topic of %s, we should also note that old-style formatting must also be preserved, since some %s still uses it." % ("formatting", "code")
121
122 old_fmt_string2 = "This is a %s %s %s %s" % ("really really really really really", "old", "way to format strings!", "Use f-strings instead!")
123
124 old_fmt_string3 = "Whereas only the strings after the percent sign were long in the last example, this example uses a long initial string as well. This is another %s %s %s %s" % ("really really really really really", "old", "way to format strings!", "Use f-strings instead!")
125
126 fstring = f"f-strings definitely make things more {difficult} than they need to be for {{black}}. But boy they sure are handy. The problem is that some lines will need to have the 'f' whereas others do not. This {line}, for example, needs one."
127
128 fstring_with_no_fexprs = f"Some regular string that needs to get split certainly but is NOT an fstring by any means whatsoever."
129
130 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.
131
132 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.
133     "Arg #2", "Arg #3", "Arg #4", "Arg #5")
134
135 pragma_comment_string1 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa: E501
136
137 pragma_comment_string2 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa
138
139 """This is a really really really long triple quote string and it should not be touched."""
140
141 triple_quote_string = """This is a really really really long triple quote string assignment and it should not be touched."""
142
143 assert some_type_of_boolean_expression, "Followed by a really really really long string that is used to provide context to the AssertionError exception."
144
145 assert some_type_of_boolean_expression, "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic string {}.".format("formatting")
146
147 assert some_type_of_boolean_expression, "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic string %s." % "formatting"
148
149 assert some_type_of_boolean_expression, "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic %s %s." % ("string", "formatting")
150
151 some_function_call("With a reallly generic name and with a really really long string that is, at some point down the line, " + added + " to a variable and then added to another string.")
152
153 some_function_call("With a reallly generic name and with a really really long string that is, at some point down the line, " + added + " to a variable and then added to another string. But then what happens when the final string is also supppppperrrrr long?! Well then that second (realllllllly long) string should be split too.", "and a second argument", and_a_third)
154
155 return "A really really really really really really really really really really really really really long {} {}".format("return", "value")
156
157 func_with_bad_comma(
158     "This is a really long string argument to a function that has a trailing comma which should NOT be there.",
159 )
160
161 func_with_bad_comma(
162     "This is a really long string argument to a function that has a trailing comma which should NOT be there.", # comment after comma
163 )
164
165 func_with_bad_comma(
166     (
167         "This is a really long string argument to a function that has a trailing comma"
168         " which should NOT be there."
169     ),
170 )
171
172 func_with_bad_comma(
173     (
174         "This is a really long string argument to a function that has a trailing comma"
175         " which should NOT be there."
176     ), # comment after comma
177 )
178
179 func_with_bad_parens_that_wont_fit_in_one_line(
180     ("short string that should have parens stripped"),
181     x,
182     y,
183     z
184 )
185
186 func_with_bad_parens_that_wont_fit_in_one_line(
187     x,
188     y,
189     ("short string that should have parens stripped"),
190     z
191 )
192
193 func_with_bad_parens(
194     ("short string that should have parens stripped"),
195     x,
196     y,
197     z,
198 )
199
200 func_with_bad_parens(
201     x,
202     y,
203     ("short string that should have parens stripped"),
204     z,
205 )
206
207 annotated_variable: Final = "This is a large " + STRING + " that has been " + CONCATENATED + "using the '+' operator."
208 annotated_variable: Final = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
209 annotated_variable: Literal["fakse_literal"] = "This is a large string that has a type annotation attached to it. A type annotation should NOT stop a long string from being wrapped."
210
211 backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\"
212 backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\\\"
213 backslashes = "This is a really 'long' string with \"embedded double quotes\" and 'single' quotes that also handles checking for an odd number of backslashes \\\", like this...\\\\\\"
214
215 short_string = (
216     "Hi"
217     " there."
218 )
219
220 func_call(
221     short_string=(
222         "Hi"
223         " there."
224     )
225 )
226
227 raw_strings = r"Don't" " get" r" merged" " unless they are all raw."
228
229 def foo():
230     yield "This is a really long string that can't possibly be expected to fit all together on one line. In fact it may even take up three or more lines... like four or five... but probably just three."
231
232 x = f"This is a {{really}} long string that needs to be split without a doubt (i.e. most definitely). In short, this {string} that can't possibly be {{expected}} to fit all together on one line. In {fact} it may even take up three or more lines... like four or five... but probably just four."
233
234 long_unmergable_string_with_pragma = (
235     "This is a really long string that can't be merged because it has a likely pragma at the end"  # type: ignore
236     " of it."
237 )
238
239 long_unmergable_string_with_pragma = (
240     "This is a really long string that can't be merged because it has a likely pragma at the end"  # noqa
241     " of it."
242 )
243
244 long_unmergable_string_with_pragma = (
245     "This is a really long string that can't be merged because it has a likely pragma at the end"  # pylint: disable=some-pylint-check
246     " of it."
247 )
248
249 string_with_nameescape = (
250     "........................................................................ \N{LAO KO LA}"
251 )
252
253 string_with_nameescape = (
254     "........................................................................... \N{LAO KO LA}"
255 )
256
257 string_with_nameescape = (
258     "............................................................................ \N{LAO KO LA}"
259 )
260
261 string_with_nameescape_and_escaped_backslash = (
262     "...................................................................... \\\N{LAO KO LA}"
263 )
264
265 string_with_nameescape_and_escaped_backslash = (
266     "......................................................................... \\\N{LAO KO LA}"
267 )
268
269 string_with_nameescape_and_escaped_backslash = (
270     ".......................................................................... \\\N{LAO KO LA}"
271 )
272
273 string_with_escaped_nameescape = (
274     "........................................................................ \\N{LAO KO LA}"
275 )
276
277 string_with_escaped_nameescape = (
278     "........................................................................... \\N{LAO KO LA}"
279 )
280
281
282 # output
283
284
285 x = (
286     "This is a really long string that can't possibly be expected to fit all together"
287     " on one line. In fact it may even take up three or more lines... like four or"
288     " five... but probably just three."
289 )
290
291 x += (
292     "This is a really long string that can't possibly be expected to fit all together"
293     " on one line. In fact it may even take up three or more lines... like four or"
294     " five... but probably just three."
295 )
296
297 y = "Short string"
298
299 print(
300     (
301         "This is a really long string inside of a print statement with extra arguments"
302         " attached at the end of it."
303     ),
304     x,
305     y,
306     z,
307 )
308
309 print(
310     "This is a really long string inside of a print statement with no extra arguments"
311     " attached at the end of it."
312 )
313
314 D1 = {
315     "The First": (
316         "This is a really long string that can't possibly be expected to fit all"
317         " together on one line. Also it is inside a dictionary, so formatting is more"
318         " difficult."
319     ),
320     "The Second": (
321         "This is another really really (not really) long string that also can't be"
322         " expected to fit on one line and is, like the other string, inside a"
323         " dictionary."
324     ),
325 }
326
327 D2 = {
328     1.0: (
329         "This is a really long string that can't possibly be expected to fit all"
330         " together on one line. Also it is inside a dictionary, so formatting is more"
331         " difficult."
332     ),
333     2.0: (
334         "This is another really really (not really) long string that also can't be"
335         " expected to fit on one line and is, like the other string, inside a"
336         " dictionary."
337     ),
338 }
339
340 D3 = {
341     x: (
342         "This is a really long string that can't possibly be expected to fit all"
343         " together on one line. Also it is inside a dictionary, so formatting is more"
344         " difficult."
345     ),
346     y: (
347         "This is another really really (not really) long string that also can't be"
348         " expected to fit on one line and is, like the other string, inside a"
349         " dictionary."
350     ),
351 }
352
353 D4 = {
354     "A long and ridiculous {}".format(string_key): (
355         "This is a really really really long string that has to go i,side of a"
356         " dictionary. It is soooo bad."
357     ),
358     some_func("calling", "some", "stuff"): (
359         "This is a really really really long string that has to go inside of a"
360         " dictionary. It is {soooo} bad (#{x}).".format(sooo="soooo", x=2)
361     ),
362     "A %s %s"
363     % ("formatted", "string"): (
364         "This is a really really really long string that has to go inside of a"
365         " dictionary. It is %s bad (#%d)."
366     )
367     % ("soooo", 2),
368 }
369
370 D5 = {  # Test for https://github.com/psf/black/issues/3261
371     "This is a really long string that can't be expected to fit in one line and is used as a nested dict's key": {
372         "inner": "value"
373     },
374 }
375
376 D6 = {  # Test for https://github.com/psf/black/issues/3261
377     "This is a really long string that can't be expected to fit in one line and is used as a dict's key": [
378         "value1",
379         "value2",
380     ],
381 }
382
383 L1 = [
384     "The is a short string",
385     (
386         "This is a really long string that can't possibly be expected to fit all"
387         " together on one line. Also it is inside a list literal, so it's expected to"
388         " be wrapped in parens when spliting to avoid implicit str concatenation."
389     ),
390     short_call("arg", {"key": "value"}),
391     (
392         "This is another really really (not really) long string that also can't be"
393         " expected to fit on one line and is, like the other string, inside a list"
394         " literal."
395     ),
396     "parens should be stripped for short string in list",
397 ]
398
399 L2 = [
400     "This is a really long string that can't be expected to fit in one line and is the"
401     " only child of a list literal."
402 ]
403
404 S1 = {
405     "The is a short string",
406     (
407         "This is a really long string that can't possibly be expected to fit all"
408         " together on one line. Also it is inside a set literal, so it's expected to be"
409         " wrapped in parens when spliting to avoid implicit str concatenation."
410     ),
411     short_call("arg", {"key": "value"}),
412     (
413         "This is another really really (not really) long string that also can't be"
414         " expected to fit on one line and is, like the other string, inside a set"
415         " literal."
416     ),
417     "parens should be stripped for short string in set",
418 }
419
420 S2 = {
421     "This is a really long string that can't be expected to fit in one line and is the"
422     " only child of a set literal."
423 }
424
425 T1 = (
426     "The is a short string",
427     (
428         "This is a really long string that can't possibly be expected to fit all"
429         " together on one line. Also it is inside a tuple literal, so it's expected to"
430         " be wrapped in parens when spliting to avoid implicit str concatenation."
431     ),
432     short_call("arg", {"key": "value"}),
433     (
434         "This is another really really (not really) long string that also can't be"
435         " expected to fit on one line and is, like the other string, inside a tuple"
436         " literal."
437     ),
438     "parens should be stripped for short string in list",
439 )
440
441 T2 = (
442     (
443         "This is a really long string that can't be expected to fit in one line and is"
444         " the only child of a tuple literal."
445     ),
446 )
447
448 func_with_keywords(
449     my_arg,
450     my_kwarg=(
451         "Long keyword strings also need to be wrapped, but they will probably need to"
452         " be handled a little bit differently."
453     ),
454 )
455
456 bad_split1 = (
457     "But what should happen when code has already been formatted but in the wrong way?"
458     " Like with a space at the end instead of the beginning. Or what about when it is"
459     " split too soon?"
460 )
461
462 bad_split2 = (
463     "But what should happen when code has already "
464     "been formatted but in the wrong way? Like "
465     "with a space at the end instead of the "
466     "beginning. Or what about when it is split too "
467     "soon? In the case of a split that is too "
468     "short, black will try to honer the custom "
469     "split."
470 )
471
472 bad_split3 = (
473     "What if we have inline comments on "  # First Comment
474     "each line of a bad split? In that "  # Second Comment
475     "case, we should just leave it alone."  # Third Comment
476 )
477
478 bad_split_func1(
479     (
480         "But what should happen when code has already "
481         "been formatted but in the wrong way? Like "
482         "with a space at the end instead of the "
483         "beginning. Or what about when it is split too "
484         "soon? In the case of a split that is too "
485         "short, black will try to honer the custom "
486         "split."
487     ),
488     xxx,
489     yyy,
490     zzz,
491 )
492
493 bad_split_func2(
494     xxx,
495     yyy,
496     zzz,
497     long_string_kwarg=(
498         "But what should happen when code has already been formatted but in the wrong"
499         " way? Like with a space at the end instead of the beginning. Or what about"
500         " when it is split too soon?"
501     ),
502 )
503
504 bad_split_func3(
505     (
506         "But what should happen when code has already "
507         r"been formatted but in the wrong way? Like "
508         "with a space at the end instead of the "
509         r"beginning. Or what about when it is split too "
510         r"soon? In the case of a split that is too "
511         "short, black will try to honer the custom "
512         "split."
513     ),
514     xxx,
515     yyy,
516     zzz,
517 )
518
519 inline_comments_func1(
520     "if there are inline comments in the middle "
521     # Here is the standard alone comment.
522     "of the implicitly concatenated string, we should handle them correctly",
523     xxx,
524 )
525
526 inline_comments_func2(
527     "what if the string is very very very very very very very very very very long and"
528     " this part does not fit into a single line? "
529     # Here is the standard alone comment.
530     "then the string should still be properly handled by merging and splitting "
531     "it into parts that fit in line length.",
532     xxx,
533 )
534
535 raw_string = (
536     r"This is a long raw string. When re-formatting this string, black needs to make"
537     r" sure it prepends the 'r' onto the new string."
538 )
539
540 fmt_string1 = (
541     "We also need to be sure to preserve any and all {} which may or may not be"
542     " attached to the string in question.".format("method calls")
543 )
544
545 fmt_string2 = "But what about when the string is {} but {}".format(
546     "short",
547     "the method call is really really really really really really really really long?",
548 )
549
550 old_fmt_string1 = (
551     "While we are on the topic of %s, we should also note that old-style formatting"
552     " must also be preserved, since some %s still uses it." % ("formatting", "code")
553 )
554
555 old_fmt_string2 = "This is a %s %s %s %s" % (
556     "really really really really really",
557     "old",
558     "way to format strings!",
559     "Use f-strings instead!",
560 )
561
562 old_fmt_string3 = (
563     "Whereas only the strings after the percent sign were long in the last example,"
564     " this example uses a long initial string as well. This is another %s %s %s %s"
565     % (
566         "really really really really really",
567         "old",
568         "way to format strings!",
569         "Use f-strings instead!",
570     )
571 )
572
573 fstring = (
574     f"f-strings definitely make things more {difficult} than they need to be for"
575     " {black}. But boy they sure are handy. The problem is that some lines will need"
576     f" to have the 'f' whereas others do not. This {line}, for example, needs one."
577 )
578
579 fstring_with_no_fexprs = (
580     f"Some regular string that needs to get split certainly but is NOT an fstring by"
581     f" any means whatsoever."
582 )
583
584 comment_string = (  # This comment gets thrown to the top.
585     "Long lines with inline comments should have their comments appended to the"
586     " reformatted string's enclosing right parentheses."
587 )
588
589 arg_comment_string = print(
590     (  # This comment gets thrown to the top.
591         "Long lines with inline comments which are apart of (and not the only member"
592         " of) an argument list should have their comments appended to the reformatted"
593         " string's enclosing left parentheses."
594     ),
595     "Arg #2",
596     "Arg #3",
597     "Arg #4",
598     "Arg #5",
599 )
600
601 pragma_comment_string1 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa: E501
602
603 pragma_comment_string2 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa
604
605 """This is a really really really long triple quote string and it should not be touched."""
606
607 triple_quote_string = """This is a really really really long triple quote string assignment and it should not be touched."""
608
609 assert some_type_of_boolean_expression, (
610     "Followed by a really really really long string that is used to provide context to"
611     " the AssertionError exception."
612 )
613
614 assert some_type_of_boolean_expression, (
615     "Followed by a really really really long string that is used to provide context to"
616     " the AssertionError exception, which uses dynamic string {}.".format("formatting")
617 )
618
619 assert some_type_of_boolean_expression, (
620     "Followed by a really really really long string that is used to provide context to"
621     " the AssertionError exception, which uses dynamic string %s." % "formatting"
622 )
623
624 assert some_type_of_boolean_expression, (
625     "Followed by a really really really long string that is used to provide context to"
626     " the AssertionError exception, which uses dynamic %s %s."
627     % ("string", "formatting")
628 )
629
630 some_function_call(
631     "With a reallly generic name and with a really really long string that is, at some"
632     " point down the line, "
633     + added
634     + " to a variable and then added to another string."
635 )
636
637 some_function_call(
638     "With a reallly generic name and with a really really long string that is, at some"
639     " point down the line, "
640     + added
641     + " to a variable and then added to another string. But then what happens when the"
642     " final string is also supppppperrrrr long?! Well then that second (realllllllly"
643     " long) string should be split too.",
644     "and a second argument",
645     and_a_third,
646 )
647
648 return (
649     "A really really really really really really really really really really really"
650     " really really long {} {}".format("return", "value")
651 )
652
653 func_with_bad_comma(
654     (
655         "This is a really long string argument to a function that has a trailing comma"
656         " which should NOT be there."
657     ),
658 )
659
660 func_with_bad_comma(
661     (  # comment after comma
662         "This is a really long string argument to a function that has a trailing comma"
663         " which should NOT be there."
664     ),
665 )
666
667 func_with_bad_comma(
668     (
669         "This is a really long string argument to a function that has a trailing comma"
670         " which should NOT be there."
671     ),
672 )
673
674 func_with_bad_comma(
675     (  # comment after comma
676         "This is a really long string argument to a function that has a trailing comma"
677         " which should NOT be there."
678     ),
679 )
680
681 func_with_bad_parens_that_wont_fit_in_one_line(
682     "short string that should have parens stripped", x, y, z
683 )
684
685 func_with_bad_parens_that_wont_fit_in_one_line(
686     x, y, "short string that should have parens stripped", z
687 )
688
689 func_with_bad_parens(
690     "short string that should have parens stripped",
691     x,
692     y,
693     z,
694 )
695
696 func_with_bad_parens(
697     x,
698     y,
699     "short string that should have parens stripped",
700     z,
701 )
702
703 annotated_variable: Final = (
704     "This is a large "
705     + STRING
706     + " that has been "
707     + CONCATENATED
708     + "using the '+' operator."
709 )
710 annotated_variable: Final = (
711     "This is a large string that has a type annotation attached to it. A type"
712     " annotation should NOT stop a long string from being wrapped."
713 )
714 annotated_variable: Literal["fakse_literal"] = (
715     "This is a large string that has a type annotation attached to it. A type"
716     " annotation should NOT stop a long string from being wrapped."
717 )
718
719 backslashes = (
720     "This is a really long string with \"embedded\" double quotes and 'single' quotes"
721     " that also handles checking for an even number of backslashes \\"
722 )
723 backslashes = (
724     "This is a really long string with \"embedded\" double quotes and 'single' quotes"
725     " that also handles checking for an even number of backslashes \\\\"
726 )
727 backslashes = (
728     "This is a really 'long' string with \"embedded double quotes\" and 'single' quotes"
729     ' that also handles checking for an odd number of backslashes \\", like'
730     " this...\\\\\\"
731 )
732
733 short_string = "Hi there."
734
735 func_call(short_string="Hi there.")
736
737 raw_strings = r"Don't" " get" r" merged" " unless they are all raw."
738
739
740 def foo():
741     yield (
742         "This is a really long string that can't possibly be expected to fit all"
743         " together on one line. In fact it may even take up three or more lines... like"
744         " four or five... but probably just three."
745     )
746
747
748 x = (
749     "This is a {really} long string that needs to be split without a doubt (i.e."
750     f" most definitely). In short, this {string} that can't possibly be {{expected}} to"
751     f" fit all together on one line. In {fact} it may even take up three or more"
752     " lines... like four or five... but probably just four."
753 )
754
755 long_unmergable_string_with_pragma = (
756     "This is a really long string that can't be merged because it has a likely pragma at the end"  # type: ignore
757     " of it."
758 )
759
760 long_unmergable_string_with_pragma = (
761     "This is a really long string that can't be merged because it has a likely pragma at the end"  # noqa
762     " of it."
763 )
764
765 long_unmergable_string_with_pragma = (
766     "This is a really long string that can't be merged because it has a likely pragma at the end"  # pylint: disable=some-pylint-check
767     " of it."
768 )
769
770 string_with_nameescape = (
771     "........................................................................"
772     " \N{LAO KO LA}"
773 )
774
775 string_with_nameescape = (
776     "..........................................................................."
777     " \N{LAO KO LA}"
778 )
779
780 string_with_nameescape = (
781     "............................................................................"
782     " \N{LAO KO LA}"
783 )
784
785 string_with_nameescape_and_escaped_backslash = (
786     "......................................................................"
787     " \\\N{LAO KO LA}"
788 )
789
790 string_with_nameescape_and_escaped_backslash = (
791     "........................................................................."
792     " \\\N{LAO KO LA}"
793 )
794
795 string_with_nameescape_and_escaped_backslash = (
796     ".........................................................................."
797     " \\\N{LAO KO LA}"
798 )
799
800 string_with_escaped_nameescape = (
801     "........................................................................ \\N{LAO"
802     " KO LA}"
803 )
804
805 string_with_escaped_nameescape = (
806     "..........................................................................."
807     " \\N{LAO KO LA}"
808 )