]> git.madduck.net Git - etc/vim.git/blob - tests/data/long_strings__regression.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:

cd8053f9eb5813627f5c2c26a3fdb2dde80f6297
[etc/vim.git] / tests / data / long_strings__regression.py
1 class A:
2     def foo():
3         result = type(message)("")
4
5
6 # Don't merge multiline (e.g. triple-quoted) strings.
7 def foo():
8     query = (
9         """SELECT xxxxxxxxxxxxxxxxxxxx(xxx)"""
10         """ FROM xxxxxxxxxxxxxxxx WHERE xxxxxxxxxx AND xxx <> xxxxxxxxxxxxxx()""")
11
12 # There was a bug where tuples were being identified as long strings.
13 long_tuple = ('Apple', 'Berry', 'Cherry', 'Dill', 'Evergreen', 'Fig',
14            'Grape', 'Harry', 'Iglu', 'Jaguar')
15
16 stupid_format_method_bug = "Some really long string that just so happens to be the {} {} to force the 'format' method to hang over the line length boundary. This is pretty annoying.".format("perfect", "length")
17
18 class A:
19     def foo():
20         os.system("This is a regression test. xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxxx.".format("xxxxxxxxxx", "xxxxxx", "xxxxxxxxxx"))
21
22
23 class A:
24     def foo():
25         XXXXXXXXXXXX.append(
26             (
27                 "xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx, xxxx_xxxx_xxxxxxxxxx={})".format(
28                     xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx
29                 ),
30                 my_var,
31                 my_other_var,
32             )
33         )
34
35 class A:
36     class B:
37         def foo():
38             bar(
39                 (
40                     "[{}]: xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx={}"
41                     " xxxx_xxxx_xxxxxxxxxx={}, xxxx={})"
42                     .format(xxxx._xxxxxxxxxxxxxx, xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx, xxxxxxx)
43                 ),
44                 varX,
45                 varY,
46                 varZ,
47             )
48
49 def foo(xxxx):
50     for (xxx_xxxx, _xxx_xxx, _xxx_xxxxx, xxx_xxxx) in xxxx:
51         for xxx in xxx_xxxx:
52             assert ("x" in xxx) or (
53                 xxx in xxx_xxx_xxxxx
54             ), "{0} xxxxxxx xx {1}, xxx {1} xx xxx xx xxxx xx xxx xxxx: xxx xxxx {2}".format(
55                 xxx_xxxx, xxx, xxxxxx.xxxxxxx(xxx_xxx_xxxxx)
56             )
57
58 class A:
59     def disappearing_comment():
60         return (
61             (  # xx -x xxxxxxx xx xxx xxxxxxx.
62                 '{{xxx_xxxxxxxxxx_xxxxxxxx}} xxx xxxx'
63                 ' {} {{xxxx}} >&2'
64                 .format(
65                     "{xxxx} {xxxxxx}"
66                     if xxxxx.xx_xxxxxxxxxx
67                     else ( # Disappearing Comment
68                         "--xxxxxxx --xxxxxx=x --xxxxxx-xxxxx=xxxxxx"
69                         " --xxxxxx-xxxx=xxxxxxxxxxx.xxx"
70                     )
71                 )
72             ),
73             (x, y, z),
74         )
75
76 class A:
77     class B:
78         def foo():
79             xxxxx_xxxx(
80                 xx, "\t"
81                 "@xxxxxx '{xxxx_xxx}\t' > {xxxxxx_xxxx}.xxxxxxx;"
82                 "{xxxx_xxx} >> {xxxxxx_xxxx}.xxxxxxx 2>&1; xx=$$?;"
83                 "xxxx $$xx"
84                 .format(xxxx_xxx=xxxx_xxxxxxx, xxxxxx_xxxx=xxxxxxx + "/" + xxxx_xxx_xxxx, x=xxx_xxxxx_xxxxx_xxx),
85                 x,
86                 y,
87                 z,
88             )
89
90 func_call_where_string_arg_has_method_call_and_bad_parens(
91     (
92         "A long string with {}. This string is so long that it is ridiculous. It can't fit on one line at alllll.".format("formatting")
93     ),
94 )
95
96 func_call_where_string_arg_has_old_fmt_and_bad_parens(
97     (
98         "A long string with {}. This string is so long that it is ridiculous. It can't fit on one line at alllll." % "formatting"
99     ),
100 )
101
102 func_call_where_string_arg_has_old_fmt_and_bad_parens(
103     (
104         "A long string with {}. This {} is so long that it is ridiculous. It can't fit on one line at alllll." % ("formatting", "string")
105     ),
106 )
107
108 class A:
109     def append(self):
110         if True:
111             xxxx.xxxxxxx.xxxxx( ('xxxxxxxxxx xxxx xx xxxxxx(%x) xx %x xxxx xx xxx %x.xx'
112                                  % (len(self) + 1,
113                                     xxxx.xxxxxxxxxx,
114                                     xxxx.xxxxxxxxxx))
115                                 + (' %.3f (%s) to %.3f (%s).\n'
116                                    % (xxxx.xxxxxxxxx,
117                                       xxxx.xxxxxxxxxxxxxx(xxxx.xxxxxxxxx),
118                                       x,
119                                       xxxx.xxxxxxxxxxxxxx( xx)
120                                       )))
121
122 class A:
123     def foo():
124         some_func_call(
125             'xxxxxxxxxx',
126             (
127                 "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
128                 "\"xxxx xxxxxxx xxxxxx xxxx; xxxx xxxxxx_xxxxx xxxxxx xxxx; "
129                 "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" "
130             ),
131             None,
132             ('xxxxxxxxxxx',),
133         ),
134
135 class A:
136     def foo():
137         some_func_call(
138             (
139                 "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
140                 "xxxx, ('xxxxxxx xxxxxx xxxx, xxxx') xxxxxx_xxxxx xxxxxx xxxx; "
141                 "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" "
142             ),
143             None,
144             ('xxxxxxxxxxx',),
145         ),
146
147 xxxxxxx = { 'xx' : 'xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} \
148 -xx {1} -xx xxx=xxx_xxxx,xxx_xx,xxx_xxx,xxx_xxxx,xxx_xx,xxx_xxx |\
149  xxxxxx -x xxxxxxxx -x xxxxxxxx -x',
150          'xx' : 'xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} \
151 -xx {1} -xx xxx=xxx_xxxx_xxx_xxxx,xxx_xx_xxx_xxxx,xxx_xxxx_xxx_xxxx,\
152 xxx_xx_xxxx_xxxx,xxx_xxx_xxxx,xxx_xxx_xxxx xxxx=xxx | xxxxxx -x xxxxxxxx -x xxxxxxxx -x'
153 }
154
155 class A:
156     def foo(self):
157         if True:
158             xxxxx_xxxxxxxxxxxx('xxx xxxxxx xxx xxxxxxxxx.xx xx xxxxxxxx.  xxx xxxxxxxxxxxxx.xx xxxxxxx '
159                                + 'xx xxxxxx xxxxxx xxxxxx xx xxxxxxx xxx xxx ${0} xx x xxxxxxxx xxxxx'.xxxxxx(xxxxxx_xxxxxx_xxx))
160
161 class A:
162     class B:
163         def foo():
164             row = {
165                 'xxxxxxxxxxxxxxx' : xxxxxx_xxxxx_xxxx,
166                 # 'xxxxxxxxxxxxxxxxxxxxxxx'
167                 # 'xxxxxxxxxxxxxxxxxxxxxx'
168                 # 'xxxxxxxxxxxxxxxxxx'
169                 # 'xxxxxxxxxxxxxxxxx'
170                 'xxxxxxxxxx' : xxxxx_xxxxx,
171                 }
172
173 class A:
174     def xxxx_xxx_xx_xxxxxxxxxx_xxxx_xxxxxxxxx(xxxx):
175         xxxxxxxx = [
176             xxxxxxxxxxxxxxxx(
177                 'xxxx',
178                 xxxxxxxxxxx={
179                     'xxxx' : 1.0,
180                 },
181                 xxxxxx={'xxxxxx 1' : xxxxxx(xxxx='xxxxxx 1', xxxxxx=600.0)},
182                 xxxxxxxx_xxxxxxx=0.0,
183             ),
184             xxxxxxxxxxxxxxxx(
185                 'xxxxxxx',
186                 xxxxxxxxxxx={
187                     'xxxx' : 1.0,
188                 },
189                 xxxxxx={'xxxxxx 1' : xxxxxx(xxxx='xxxxxx 1', xxxxxx=200.0)},
190                 xxxxxxxx_xxxxxxx=0.0,
191             ),
192             xxxxxxxxxxxxxxxx(
193                 'xxxx',
194             ),
195         ]
196
197 some_dictionary = {
198     'xxxxx006': ['xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx== xxxxx000 xxxxxxxxxx\n',
199                  'xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx== xxxxx010 xxxxxxxxxx\n'],
200     'xxxxx016': ['xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx== xxxxx000 xxxxxxxxxx\n',
201                  'xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx== xxxxx010 xxxxxxxxxx\n']
202 }
203
204 def foo():
205     xxx_xxx = (
206         'xxxx xxx xxxxxxxx_xxxx xx "xxxxxxxxxx".'
207         '\n xxx: xxxxxx xxxxxxxx_xxxx=xxxxxxxxxx'
208     ) # xxxx xxxxxxxxxx xxxx xx xxxx xx xxx xxxxxxxx xxxxxx xxxxx.
209
210 some_tuple = ("some string", "some string" " which should be joined")
211
212 some_commented_string = (
213     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # This comment gets thrown to the top.
214     " {} that I just can't think of any more good words to say about it at"
215     " allllllllllll".format("ha")  # comments here are fine
216 )
217
218 some_commented_string = (
219     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # But these
220     " {} that I just can't think of any more good words to say about it at"  # comments will stay
221     " allllllllllll".format("ha")  # comments here are fine
222 )
223
224 lpar_and_rpar_have_comments = func_call(  # LPAR Comment
225     "Long really ridiculous type of string that shouldn't really even exist at all. I mean commmme onnn!!!",  # Comma Comment
226 )  # RPAR Comment
227
228 cmd_fstring = (
229     f"sudo -E deluge-console info --detailed --sort-reverse=time_added "
230     f"{'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
231 )
232
233 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
234
235 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {'{{}}' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
236
237 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {{'' if ID is None else ID}} | perl -nE 'print if /^{field}:/'"
238
239 fstring = f"This string really doesn't need to be an {{{{fstring}}}}, but this one most certainly, absolutely {does}."
240
241 fstring = (
242     f"We have to remember to escape {braces}."
243     " Like {these}."
244     f" But not {this}."
245 )
246
247 class A:
248     class B:
249         def foo():
250             st_error = STError(
251                 f"This string ({string_leaf.value}) appears to be pointless (i.e. has"
252                 " no parent)."
253             )
254
255 def foo():
256     user_regex = _lazy_re_compile(
257         r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"  # dot-atom
258         r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)',  # quoted-string
259         re.IGNORECASE)
260
261 def foo():
262     user_regex = _lazy_re_compile(
263         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
264         'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  # quoted-string
265         xyz
266     )
267
268 def foo():
269     user_regex = _lazy_re_compile(
270         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
271         'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  # quoted-string
272         xyz
273     )
274
275 class A:
276     class B:
277         def foo():
278             if not hasattr(module, name):
279                 raise ValueError(
280                     "Could not find object %s in %s.\n"
281                     "Please note that you cannot serialize things like inner "
282                     "classes. Please move the object into the main module "
283                     "body to use migrations.\n"
284                     "For more information, see "
285                     "https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
286                     % (name, module_name, get_docs_version()))
287
288 class A:
289     class B:
290         def foo():
291             if not hasattr(module, name):
292                 raise ValueError(
293                     "Could not find object %s in %s.\nPlease note that you cannot serialize things like inner classes. Please move the object into the main module body to use migrations.\nFor more information, see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
294                     % (name, module_name, get_docs_version()))
295
296 x = (
297     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
298     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
299     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
300     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
301 )
302
303 class Step(StepBase):
304     def who(self):
305         self.cmd = 'SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name} {title}/P{passenger_association}'.format(
306             last_name=last_name,
307             first_name=first_name,
308             middle_name=middle_name,
309             title=title,
310             passenger_association=passenger_association,
311         )
312
313 xxxxxxx_xxxxxx_xxxxxxx = xxx(
314     [
315         xxxxxxxxxxxx(
316             xxxxxx_xxxxxxx=(
317                 '((x.aaaaaaaaa = "xxxxxx.xxxxxxxxxxxxxxxxxxxxx") || (x.xxxxxxxxx = "xxxxxxxxxxxx")) && '
318                 # xxxxx xxxxxxxxxxxx xxxx xxx (xxxxxxxxxxxxxxxx) xx x xxxxxxxxx xx xxxxxx.
319                 "(x.bbbbbbbbbbbb.xxx != "
320                 '"xxx:xxx:xxx::cccccccccccc:xxxxxxx-xxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxx") && '
321             )
322         )
323     ]
324 )
325
326 if __name__ == "__main__":
327     for i in range(4, 8):
328         cmd = (
329             r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk '{print $2}'); do kill $pid; done"
330             % (i)
331         )
332
333 def A():
334     def B():
335         def C():
336             def D():
337                 def E():
338                     def F():
339                         def G():
340                             assert (
341                                 c_float(val[0][0] / val[0][1]).value
342                                 == c_float(value[0][0] / value[0][1]).value
343                             ), "%s didn't roundtrip" % tag
344
345 class xxxxxxxxxxxxxxxxxxxxx(xxxx.xxxxxxxxxxxxx):
346     def xxxxxxx_xxxxxx(xxxx):
347         assert xxxxxxx_xxxx in [
348             x.xxxxx.xxxxxx.xxxxx.xxxxxx,
349             x.xxxxx.xxxxxx.xxxxx.xxxx,
350         ], ("xxxxxxxxxxx xxxxxxx xxxx (xxxxxx xxxx) %x xxx xxxxx" % xxxxxxx_xxxx)
351
352 value.__dict__[
353     key
354 ] = "test"  # set some Thrift field to non-None in the struct aa bb cc dd ee
355
356 RE_ONE_BACKSLASH = {
357     "asdf_hjkl_jkl": re.compile(
358         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\ )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
359     ),
360 }
361
362 RE_TWO_BACKSLASHES = {
363     "asdf_hjkl_jkl": re.compile(
364         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\\ )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
365     ),
366 }
367
368 RE_THREE_BACKSLASHES = {
369     "asdf_hjkl_jkl": re.compile(
370         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\\\ )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
371     ),
372 }
373
374 # We do NOT split on f-string expressions.
375 print(f"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam. {[f'{i}' for i in range(10)]}")
376 x = f"This is a long string which contains an f-expr that should not split {{{[i for i in range(5)]}}}."
377
378 # The parens should NOT be removed in this case.
379 (
380     "my very long string that should get formatted if I'm careful to make sure it goes"
381     " over 88 characters which it has now"
382 )
383
384 # The parens should NOT be removed in this case.
385 (
386     "my very long string that should get formatted if I'm careful to make sure it goes over 88 characters which"
387     " it has now"
388 )
389
390 # The parens should NOT be removed in this case.
391 (
392     "my very long string"
393     " that should get formatted"
394     " if I'm careful to make sure"
395     " it goes over 88 characters which"
396     " it has now"
397 )
398
399
400 def _legacy_listen_examples():
401     text += (
402         "    \"listen for the '%(event_name)s' event\"\n"
403         "\n    # ... (event logic logic logic) ...\n"
404         % {
405             "since": since,
406         }
407     )
408
409
410 temp_msg = (
411     f"{f'{humanize_number(pos)}.': <{pound_len+2}} "
412     f"{balance: <{bal_len + 5}} "
413     f"<<{author.display_name}>>\n"
414 )
415
416 assert str(suffix_arr) == (
417     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
418     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
419     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
420 )
421 assert str(suffix_arr) != (
422     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
423     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
424     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
425 )
426 assert str(suffix_arr) <= (
427     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
428     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
429     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
430 )
431 assert str(suffix_arr) >= (
432     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
433     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
434     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
435 )
436 assert str(suffix_arr) < (
437     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
438     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
439     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
440 )
441 assert str(suffix_arr) > (
442     "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
443     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
444     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
445 )
446 assert str(suffix_arr) in "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', 'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', 'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
447 assert str(suffix_arr) not in "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', 'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', 'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
448
449 # output
450
451
452 class A:
453     def foo():
454         result = type(message)("")
455
456
457 # Don't merge multiline (e.g. triple-quoted) strings.
458 def foo():
459     query = (
460         """SELECT xxxxxxxxxxxxxxxxxxxx(xxx)"""
461         """ FROM xxxxxxxxxxxxxxxx WHERE xxxxxxxxxx AND xxx <> xxxxxxxxxxxxxx()"""
462     )
463
464
465 # There was a bug where tuples were being identified as long strings.
466 long_tuple = (
467     "Apple",
468     "Berry",
469     "Cherry",
470     "Dill",
471     "Evergreen",
472     "Fig",
473     "Grape",
474     "Harry",
475     "Iglu",
476     "Jaguar",
477 )
478
479 stupid_format_method_bug = (
480     "Some really long string that just so happens to be the {} {} to force the 'format'"
481     " method to hang over the line length boundary. This is pretty annoying.".format(
482         "perfect", "length"
483     )
484 )
485
486
487 class A:
488     def foo():
489         os.system(
490             "This is a regression test. xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx"
491             " xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx"
492             " xxxx.".format("xxxxxxxxxx", "xxxxxx", "xxxxxxxxxx")
493         )
494
495
496 class A:
497     def foo():
498         XXXXXXXXXXXX.append(
499             (
500                 "xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx, xxxx_xxxx_xxxxxxxxxx={})"
501                 .format(xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx),
502                 my_var,
503                 my_other_var,
504             )
505         )
506
507
508 class A:
509     class B:
510         def foo():
511             bar(
512                 "[{}]: xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx={}"
513                 " xxxx_xxxx_xxxxxxxxxx={}, xxxx={})".format(
514                     xxxx._xxxxxxxxxxxxxx, xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx, xxxxxxx
515                 ),
516                 varX,
517                 varY,
518                 varZ,
519             )
520
521
522 def foo(xxxx):
523     for (xxx_xxxx, _xxx_xxx, _xxx_xxxxx, xxx_xxxx) in xxxx:
524         for xxx in xxx_xxxx:
525             assert ("x" in xxx) or (xxx in xxx_xxx_xxxxx), (
526                 "{0} xxxxxxx xx {1}, xxx {1} xx xxx xx xxxx xx xxx xxxx: xxx xxxx {2}"
527                 .format(xxx_xxxx, xxx, xxxxxx.xxxxxxx(xxx_xxx_xxxxx))
528             )
529
530
531 class A:
532     def disappearing_comment():
533         return (
534             (  # xx -x xxxxxxx xx xxx xxxxxxx.
535                 "{{xxx_xxxxxxxxxx_xxxxxxxx}} xxx xxxx {} {{xxxx}} >&2".format(
536                     "{xxxx} {xxxxxx}"
537                     if xxxxx.xx_xxxxxxxxxx
538                     else (  # Disappearing Comment
539                         "--xxxxxxx --xxxxxx=x --xxxxxx-xxxxx=xxxxxx"
540                         " --xxxxxx-xxxx=xxxxxxxxxxx.xxx"
541                     )
542                 )
543             ),
544             (x, y, z),
545         )
546
547
548 class A:
549     class B:
550         def foo():
551             xxxxx_xxxx(
552                 xx,
553                 "\t"
554                 "@xxxxxx '{xxxx_xxx}\t' > {xxxxxx_xxxx}.xxxxxxx;"
555                 "{xxxx_xxx} >> {xxxxxx_xxxx}.xxxxxxx 2>&1; xx=$$?;"
556                 "xxxx $$xx".format(
557                     xxxx_xxx=xxxx_xxxxxxx,
558                     xxxxxx_xxxx=xxxxxxx + "/" + xxxx_xxx_xxxx,
559                     x=xxx_xxxxx_xxxxx_xxx,
560                 ),
561                 x,
562                 y,
563                 z,
564             )
565
566
567 func_call_where_string_arg_has_method_call_and_bad_parens(
568     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
569     " on one line at alllll.".format("formatting"),
570 )
571
572 func_call_where_string_arg_has_old_fmt_and_bad_parens(
573     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
574     " on one line at alllll." % "formatting",
575 )
576
577 func_call_where_string_arg_has_old_fmt_and_bad_parens(
578     "A long string with {}. This {} is so long that it is ridiculous. It can't fit on"
579     " one line at alllll." % ("formatting", "string"),
580 )
581
582
583 class A:
584     def append(self):
585         if True:
586             xxxx.xxxxxxx.xxxxx(
587                 "xxxxxxxxxx xxxx xx xxxxxx(%x) xx %x xxxx xx xxx %x.xx"
588                 % (len(self) + 1, xxxx.xxxxxxxxxx, xxxx.xxxxxxxxxx)
589                 + " %.3f (%s) to %.3f (%s).\n"
590                 % (
591                     xxxx.xxxxxxxxx,
592                     xxxx.xxxxxxxxxxxxxx(xxxx.xxxxxxxxx),
593                     x,
594                     xxxx.xxxxxxxxxxxxxx(xx),
595                 )
596             )
597
598
599 class A:
600     def foo():
601         some_func_call(
602             "xxxxxxxxxx",
603             "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
604             '"xxxx xxxxxxx xxxxxx xxxx; xxxx xxxxxx_xxxxx xxxxxx xxxx; '
605             "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" ",
606             None,
607             ("xxxxxxxxxxx",),
608         ),
609
610
611 class A:
612     def foo():
613         some_func_call(
614             "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
615             "xxxx, ('xxxxxxx xxxxxx xxxx, xxxx') xxxxxx_xxxxx xxxxxx xxxx; "
616             "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" ",
617             None,
618             ("xxxxxxxxxxx",),
619         ),
620
621
622 xxxxxxx = {
623     "xx": (
624         "xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} -xx {1} -xx"
625         " xxx=xxx_xxxx,xxx_xx,xxx_xxx,xxx_xxxx,xxx_xx,xxx_xxx | xxxxxx -x xxxxxxxx -x"
626         " xxxxxxxx -x"
627     ),
628     "xx": (
629         "xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} -xx {1} -xx"
630         " xxx=xxx_xxxx_xxx_xxxx,xxx_xx_xxx_xxxx,xxx_xxxx_xxx_xxxx,xxx_xx_xxxx_xxxx,xxx_xxx_xxxx,xxx_xxx_xxxx"
631         " xxxx=xxx | xxxxxx -x xxxxxxxx -x xxxxxxxx -x"
632     ),
633 }
634
635
636 class A:
637     def foo(self):
638         if True:
639             xxxxx_xxxxxxxxxxxx(
640                 "xxx xxxxxx xxx xxxxxxxxx.xx xx xxxxxxxx.  xxx xxxxxxxxxxxxx.xx"
641                 " xxxxxxx "
642                 + "xx xxxxxx xxxxxx xxxxxx xx xxxxxxx xxx xxx ${0} xx x xxxxxxxx xxxxx"
643                 .xxxxxx(xxxxxx_xxxxxx_xxx)
644             )
645
646
647 class A:
648     class B:
649         def foo():
650             row = {
651                 "xxxxxxxxxxxxxxx": xxxxxx_xxxxx_xxxx,
652                 # 'xxxxxxxxxxxxxxxxxxxxxxx'
653                 # 'xxxxxxxxxxxxxxxxxxxxxx'
654                 # 'xxxxxxxxxxxxxxxxxx'
655                 # 'xxxxxxxxxxxxxxxxx'
656                 "xxxxxxxxxx": xxxxx_xxxxx,
657             }
658
659
660 class A:
661     def xxxx_xxx_xx_xxxxxxxxxx_xxxx_xxxxxxxxx(xxxx):
662         xxxxxxxx = [
663             xxxxxxxxxxxxxxxx(
664                 "xxxx",
665                 xxxxxxxxxxx={
666                     "xxxx": 1.0,
667                 },
668                 xxxxxx={"xxxxxx 1": xxxxxx(xxxx="xxxxxx 1", xxxxxx=600.0)},
669                 xxxxxxxx_xxxxxxx=0.0,
670             ),
671             xxxxxxxxxxxxxxxx(
672                 "xxxxxxx",
673                 xxxxxxxxxxx={
674                     "xxxx": 1.0,
675                 },
676                 xxxxxx={"xxxxxx 1": xxxxxx(xxxx="xxxxxx 1", xxxxxx=200.0)},
677                 xxxxxxxx_xxxxxxx=0.0,
678             ),
679             xxxxxxxxxxxxxxxx(
680                 "xxxx",
681             ),
682         ]
683
684
685 some_dictionary = {
686     "xxxxx006": [
687         "xxx-xxx"
688         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx=="
689         " xxxxx000 xxxxxxxxxx\n",
690         "xxx-xxx"
691         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx=="
692         " xxxxx010 xxxxxxxxxx\n",
693     ],
694     "xxxxx016": [
695         "xxx-xxx"
696         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx=="
697         " xxxxx000 xxxxxxxxxx\n",
698         "xxx-xxx"
699         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx=="
700         " xxxxx010 xxxxxxxxxx\n",
701     ],
702 }
703
704
705 def foo():
706     xxx_xxx = (  # xxxx xxxxxxxxxx xxxx xx xxxx xx xxx xxxxxxxx xxxxxx xxxxx.
707         'xxxx xxx xxxxxxxx_xxxx xx "xxxxxxxxxx".\n xxx: xxxxxx xxxxxxxx_xxxx=xxxxxxxxxx'
708     )
709
710
711 some_tuple = ("some string", "some string which should be joined")
712
713 some_commented_string = (  # This comment gets thrown to the top.
714     "This string is long but not so long that it needs hahahah toooooo be so greatttt"
715     " {} that I just can't think of any more good words to say about it at"
716     " allllllllllll".format("ha")  # comments here are fine
717 )
718
719 some_commented_string = (
720     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # But these
721     " {} that I just can't think of any more good words to say about it at"  # comments will stay
722     " allllllllllll".format("ha")  # comments here are fine
723 )
724
725 lpar_and_rpar_have_comments = func_call(  # LPAR Comment
726     "Long really ridiculous type of string that shouldn't really even exist at all. I"
727     " mean commmme onnn!!!",  # Comma Comment
728 )  # RPAR Comment
729
730 cmd_fstring = (
731     "sudo -E deluge-console info --detailed --sort-reverse=time_added "
732     f"{'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
733 )
734
735 cmd_fstring = (
736     "sudo -E deluge-console info --detailed --sort-reverse=time_added"
737     f" {'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
738 )
739
740 cmd_fstring = (
741     "sudo -E deluge-console info --detailed --sort-reverse=time_added"
742     f" {'{{}}' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
743 )
744
745 cmd_fstring = (
746     "sudo -E deluge-console info --detailed --sort-reverse=time_added {'' if ID is"
747     f" None else ID}} | perl -nE 'print if /^{field}:/'"
748 )
749
750 fstring = (
751     "This string really doesn't need to be an {{fstring}}, but this one most"
752     f" certainly, absolutely {does}."
753 )
754
755 fstring = f"We have to remember to escape {braces}. Like {{these}}. But not {this}."
756
757
758 class A:
759     class B:
760         def foo():
761             st_error = STError(
762                 f"This string ({string_leaf.value}) appears to be pointless (i.e. has"
763                 " no parent)."
764             )
765
766
767 def foo():
768     user_regex = _lazy_re_compile(
769         r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"  # dot-atom
770         r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)',  # quoted-string
771         re.IGNORECASE,
772     )
773
774
775 def foo():
776     user_regex = _lazy_re_compile(
777         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
778         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",  # quoted-string
779         xyz,
780     )
781
782
783 def foo():
784     user_regex = _lazy_re_compile(
785         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
786         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",  # quoted-string
787         xyz,
788     )
789
790
791 class A:
792     class B:
793         def foo():
794             if not hasattr(module, name):
795                 raise ValueError(
796                     "Could not find object %s in %s.\n"
797                     "Please note that you cannot serialize things like inner "
798                     "classes. Please move the object into the main module "
799                     "body to use migrations.\n"
800                     "For more information, see "
801                     "https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
802                     % (name, module_name, get_docs_version())
803                 )
804
805
806 class A:
807     class B:
808         def foo():
809             if not hasattr(module, name):
810                 raise ValueError(
811                     "Could not find object %s in %s.\nPlease note that you cannot"
812                     " serialize things like inner classes. Please move the object into"
813                     " the main module body to use migrations.\nFor more information,"
814                     " see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
815                     % (name, module_name, get_docs_version())
816                 )
817
818
819 x = (
820     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
821     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
822     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
823     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
824 )
825
826
827 class Step(StepBase):
828     def who(self):
829         self.cmd = (
830             "SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name}"
831             " {title}/P{passenger_association}".format(
832                 last_name=last_name,
833                 first_name=first_name,
834                 middle_name=middle_name,
835                 title=title,
836                 passenger_association=passenger_association,
837             )
838         )
839
840
841 xxxxxxx_xxxxxx_xxxxxxx = xxx(
842     [
843         xxxxxxxxxxxx(
844             xxxxxx_xxxxxxx=(
845                 '((x.aaaaaaaaa = "xxxxxx.xxxxxxxxxxxxxxxxxxxxx") || (x.xxxxxxxxx ='
846                 ' "xxxxxxxxxxxx")) && '
847                 # xxxxx xxxxxxxxxxxx xxxx xxx (xxxxxxxxxxxxxxxx) xx x xxxxxxxxx xx xxxxxx.
848                 "(x.bbbbbbbbbbbb.xxx != "
849                 '"xxx:xxx:xxx::cccccccccccc:xxxxxxx-xxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxx") && '
850             )
851         )
852     ]
853 )
854
855 if __name__ == "__main__":
856     for i in range(4, 8):
857         cmd = (
858             r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk"
859             r" '{print $2}'); do kill $pid; done" % (i)
860         )
861
862
863 def A():
864     def B():
865         def C():
866             def D():
867                 def E():
868                     def F():
869                         def G():
870                             assert (
871                                 c_float(val[0][0] / val[0][1]).value
872                                 == c_float(value[0][0] / value[0][1]).value
873                             ), "%s didn't roundtrip" % tag
874
875
876 class xxxxxxxxxxxxxxxxxxxxx(xxxx.xxxxxxxxxxxxx):
877     def xxxxxxx_xxxxxx(xxxx):
878         assert xxxxxxx_xxxx in [
879             x.xxxxx.xxxxxx.xxxxx.xxxxxx,
880             x.xxxxx.xxxxxx.xxxxx.xxxx,
881         ], (
882             "xxxxxxxxxxx xxxxxxx xxxx (xxxxxx xxxx) %x xxx xxxxx" % xxxxxxx_xxxx
883         )
884
885
886 value.__dict__[
887     key
888 ] = "test"  # set some Thrift field to non-None in the struct aa bb cc dd ee
889
890 RE_ONE_BACKSLASH = {
891     "asdf_hjkl_jkl": re.compile(
892         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\ )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
893     ),
894 }
895
896 RE_TWO_BACKSLASHES = {
897     "asdf_hjkl_jkl": re.compile(
898         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\\"
899         r" )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
900     ),
901 }
902
903 RE_THREE_BACKSLASHES = {
904     "asdf_hjkl_jkl": re.compile(
905         r"(?<!([0-9]\ ))(?<=(^|\ ))([A-Z]+(\ )?|[0-9](\ )|[a-z](\\\ )){4,7}([A-Z]|[0-9]|[a-z])($|\b)(?!(\ ?([0-9]\ )|(\.)))"
906     ),
907 }
908
909 # We do NOT split on f-string expressions.
910 print(
911     "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam."
912     f" {[f'{i}' for i in range(10)]}"
913 )
914 x = (
915     "This is a long string which contains an f-expr that should not split"
916     f" {{{[i for i in range(5)]}}}."
917 )
918
919 # The parens should NOT be removed in this case.
920 (
921     "my very long string that should get formatted if I'm careful to make sure it goes"
922     " over 88 characters which it has now"
923 )
924
925 # The parens should NOT be removed in this case.
926 (
927     "my very long string that should get formatted if I'm careful to make sure it goes"
928     " over 88 characters which it has now"
929 )
930
931 # The parens should NOT be removed in this case.
932 (
933     "my very long string"
934     " that should get formatted"
935     " if I'm careful to make sure"
936     " it goes over 88 characters which"
937     " it has now"
938 )
939
940
941 def _legacy_listen_examples():
942     text += (
943         "    \"listen for the '%(event_name)s' event\"\n"
944         "\n    # ... (event logic logic logic) ...\n"
945         % {
946             "since": since,
947         }
948     )
949
950
951 temp_msg = (
952     f"{f'{humanize_number(pos)}.': <{pound_len+2}} "
953     f"{balance: <{bal_len + 5}} "
954     f"<<{author.display_name}>>\n"
955 )
956
957 assert (
958     str(suffix_arr)
959     == "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
960     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
961     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
962 )
963 assert (
964     str(suffix_arr)
965     != "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
966     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
967     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
968 )
969 assert (
970     str(suffix_arr)
971     <= "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
972     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
973     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
974 )
975 assert (
976     str(suffix_arr)
977     >= "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
978     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
979     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
980 )
981 assert (
982     str(suffix_arr)
983     < "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
984     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
985     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
986 )
987 assert (
988     str(suffix_arr)
989     > "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', "
990     "'grykangaroo$', 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', "
991     "'o$', 'oo$', 'roo$', 'rykangaroo$', 'ykangaroo$']"
992 )
993 assert (
994     str(suffix_arr)
995     in "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', 'grykangaroo$',"
996     " 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', 'o$', 'oo$', 'roo$', 'rykangaroo$',"
997     " 'ykangaroo$']"
998 )
999 assert (
1000     str(suffix_arr)
1001     not in "['$', 'angaroo$', 'angrykangaroo$', 'aroo$', 'garoo$', 'grykangaroo$',"
1002     " 'kangaroo$', 'ngaroo$', 'ngrykangaroo$', 'o$', 'oo$', 'roo$',"
1003     " 'rykangaroo$', 'ykangaroo$']"
1004 )