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

Fix feature detection for positional-only arguments in lambdas (#2532)
[etc/vim.git] / tests / data / long_strings_flag_disabled.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 = "Short string"
6
7 print(
8     "This is a really long string inside of a print statement with extra arguments attached at the end of it.",
9     x,
10     y,
11     z,
12 )
13
14 print(
15     "This is a really long string inside of a print statement with no extra arguments attached at the end of it."
16 )
17
18 D1 = {
19     "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.",
20     "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.",
21 }
22
23 D2 = {
24     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.",
25     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.",
26 }
27
28 D3 = {
29     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.",
30     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.",
31 }
32
33 D4 = {
34     "A long and ridiculous {}".format(
35         string_key
36     ): "This is a really really really long string that has to go i,side of a dictionary. It is soooo bad.",
37     some_func(
38         "calling", "some", "stuff"
39     ): "This is a really really really long string that has to go inside of a dictionary. It is {soooo} bad (#{x}).".format(
40         sooo="soooo", x=2
41     ),
42     "A %s %s"
43     % (
44         "formatted",
45         "string",
46     ): "This is a really really really long string that has to go inside of a dictionary. It is %s bad (#%d)."
47     % ("soooo", 2),
48 }
49
50 func_with_keywords(
51     my_arg,
52     my_kwarg="Long keyword strings also need to be wrapped, but they will probably need to be handled a little bit differently.",
53 )
54
55 bad_split1 = (
56     "But what should happen when code has already been formatted but in the wrong way? Like"
57     " with a space at the end instead of the beginning. Or what about when it is split too soon?"
58 )
59
60 bad_split2 = (
61     "But what should happen when code has already "
62     "been formatted but in the wrong way? Like "
63     "with a space at the end instead of the "
64     "beginning. Or what about when it is split too "
65     "soon? In the case of a split that is too "
66     "short, black will try to honer the custom "
67     "split."
68 )
69
70 bad_split3 = (
71     "What if we have inline comments on "  # First Comment
72     "each line of a bad split? In that "  # Second Comment
73     "case, we should just leave it alone."  # Third Comment
74 )
75
76 bad_split_func1(
77     "But what should happen when code has already "
78     "been formatted but in the wrong way? Like "
79     "with a space at the end instead of the "
80     "beginning. Or what about when it is split too "
81     "soon? In the case of a split that is too "
82     "short, black will try to honer the custom "
83     "split.",
84     xxx,
85     yyy,
86     zzz,
87 )
88
89 bad_split_func2(
90     xxx,
91     yyy,
92     zzz,
93     long_string_kwarg="But what should happen when code has already been formatted but in the wrong way? Like "
94     "with a space at the end instead of the beginning. Or what about when it is split too "
95     "soon?",
96 )
97
98 bad_split_func3(
99     (
100         "But what should happen when code has already "
101         r"been formatted but in the wrong way? Like "
102         "with a space at the end instead of the "
103         r"beginning. Or what about when it is split too "
104         r"soon? In the case of a split that is too "
105         "short, black will try to honer the custom "
106         "split."
107     ),
108     xxx,
109     yyy,
110     zzz,
111 )
112
113 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."
114
115 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(
116     "method calls"
117 )
118
119 fmt_string2 = "But what about when the string is {} but {}".format(
120     "short",
121     "the method call is really really really really really really really really long?",
122 )
123
124 old_fmt_string1 = (
125     "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."
126     % ("formatting", "code")
127 )
128
129 old_fmt_string2 = "This is a %s %s %s %s" % (
130     "really really really really really",
131     "old",
132     "way to format strings!",
133     "Use f-strings instead!",
134 )
135
136 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" % (
137     "really really really really really",
138     "old",
139     "way to format strings!",
140     "Use f-strings instead!",
141 )
142
143 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."
144
145 fstring_with_no_fexprs = f"Some regular string that needs to get split certainly but is NOT an fstring by any means whatsoever."
146
147 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.
148
149 arg_comment_string = print(
150     "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.
151     "Arg #2",
152     "Arg #3",
153     "Arg #4",
154     "Arg #5",
155 )
156
157 pragma_comment_string1 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa: E501
158
159 pragma_comment_string2 = "Lines which end with an inline pragma comment of the form `# <pragma>: <...>` should be left alone."  # noqa
160
161 """This is a really really really long triple quote string and it should not be touched."""
162
163 triple_quote_string = """This is a really really really long triple quote string assignment and it should not be touched."""
164
165 assert (
166     some_type_of_boolean_expression
167 ), "Followed by a really really really long string that is used to provide context to the AssertionError exception."
168
169 assert (
170     some_type_of_boolean_expression
171 ), "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic string {}.".format(
172     "formatting"
173 )
174
175 assert some_type_of_boolean_expression, (
176     "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic string %s."
177     % "formatting"
178 )
179
180 assert some_type_of_boolean_expression, (
181     "Followed by a really really really long string that is used to provide context to the AssertionError exception, which uses dynamic %s %s."
182     % ("string", "formatting")
183 )
184
185 some_function_call(
186     "With a reallly generic name and with a really really long string that is, at some point down the line, "
187     + added
188     + " to a variable and then added to another string."
189 )
190
191 some_function_call(
192     "With a reallly generic name and with a really really long string that is, at some point down the line, "
193     + added
194     + " 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.",
195     "and a second argument",
196     and_a_third,
197 )
198
199 return "A really really really really really really really really really really really really really long {} {}".format(
200     "return", "value"
201 )
202
203 func_with_bad_comma(
204     "This is a really long string argument to a function that has a trailing comma which should NOT be there.",
205 )
206
207 func_with_bad_comma(
208     "This is a really long string argument to a function that has a trailing comma which should NOT be there.",  # comment after comma
209 )
210
211 func_with_bad_comma(
212     (
213         "This is a really long string argument to a function that has a trailing comma"
214         " which should NOT be there."
215     ),
216 )
217
218 func_with_bad_comma(
219     (
220         "This is a really long string argument to a function that has a trailing comma"
221         " which should NOT be there."
222     ),  # comment after comma
223 )
224
225 func_with_bad_parens_that_wont_fit_in_one_line(
226     ("short string that should have parens stripped"), x, y, z
227 )
228
229 func_with_bad_parens_that_wont_fit_in_one_line(
230     x, y, ("short string that should have parens stripped"), z
231 )
232
233 func_with_bad_parens(
234     ("short string that should have parens stripped"),
235     x,
236     y,
237     z,
238 )
239
240 func_with_bad_parens(
241     x,
242     y,
243     ("short string that should have parens stripped"),
244     z,
245 )
246
247 annotated_variable: Final = (
248     "This is a large "
249     + STRING
250     + " that has been "
251     + CONCATENATED
252     + "using the '+' operator."
253 )
254 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."
255 annotated_variable: Literal[
256     "fakse_literal"
257 ] = "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."
258
259 backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\"
260 backslashes = "This is a really long string with \"embedded\" double quotes and 'single' quotes that also handles checking for an even number of backslashes \\\\"
261 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...\\\\\\"
262
263 short_string = "Hi" " there."
264
265 func_call(short_string=("Hi" " there."))
266
267 raw_strings = r"Don't" " get" r" merged" " unless they are all raw."
268
269
270 def foo():
271     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."
272
273
274 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."
275
276 long_unmergable_string_with_pragma = (
277     "This is a really long string that can't be merged because it has a likely pragma at the end"  # type: ignore
278     " of it."
279 )
280
281 long_unmergable_string_with_pragma = (
282     "This is a really long string that can't be merged because it has a likely pragma at the end"  # noqa
283     " of it."
284 )
285
286 long_unmergable_string_with_pragma = (
287     "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
288     " of it."
289 )