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

Merge commit '882d8795c6ff65c02f2657e596391748d1b6b7f5'
[etc/vim.git] / .vim / bundle / black / tests / data / cases / preview_multiline_strings.py
1 # flags: --preview
2 """cow
3 say""",
4 call(3, "dogsay", textwrap.dedent("""dove
5     coo""" % "cowabunga"))
6 call(3, "dogsay", textwrap.dedent("""dove
7 coo""" % "cowabunga"))
8 call(3, textwrap.dedent("""cow
9     moo""" % "cowabunga"), "dogsay")
10 call(3, "dogsay", textwrap.dedent("""crow
11     caw""" % "cowabunga"),)
12 call(3, textwrap.dedent("""cat
13     meow""" % "cowabunga"), {"dog", "say"})
14 call(3, {"dog", "say"}, textwrap.dedent("""horse
15     neigh""" % "cowabunga"))
16 call(3, {"dog", "say"}, textwrap.dedent("""pig
17     oink""" % "cowabunga"),)
18 textwrap.dedent("""A one-line triple-quoted string.""")
19 textwrap.dedent("""A two-line triple-quoted string
20 since it goes to the next line.""")
21 textwrap.dedent("""A three-line triple-quoted string
22 that not only goes to the next line
23 but also goes one line beyond.""")
24 textwrap.dedent("""\
25     A triple-quoted string
26     actually leveraging the textwrap.dedent functionality
27     that ends in a trailing newline,
28     representing e.g. file contents.
29 """)
30 path.write_text(textwrap.dedent("""\
31     A triple-quoted string
32     actually leveraging the textwrap.dedent functionality
33     that ends in a trailing newline,
34     representing e.g. file contents.
35 """))
36 path.write_text(textwrap.dedent("""\
37     A triple-quoted string
38     actually leveraging the textwrap.dedent functionality
39     that ends in a trailing newline,
40     representing e.g. {config_filename} file contents.
41 """.format("config_filename", config_filename)))
42 # Another use case
43 data = yaml.load("""\
44 a: 1
45 b: 2
46 """)
47 data = yaml.load("""\
48 a: 1
49 b: 2
50 """,)
51 data = yaml.load(
52     """\
53     a: 1
54     b: 2
55 """
56 )
57
58 MULTILINE = """
59 foo
60 """.replace("\n", "")
61 generated_readme = lambda project_name: """
62 {}
63
64 <Add content here!>
65 """.strip().format(project_name)
66 parser.usage += """
67 Custom extra help summary.
68
69 Extra test:
70 - with
71 - bullets
72 """
73
74
75 def get_stuff(cr, value):
76     # original
77     cr.execute("""
78         SELECT whatever
79           FROM some_table t
80          WHERE id = %s
81     """, [value])
82     return cr.fetchone()
83
84
85 def get_stuff(cr, value):
86     # preferred
87     cr.execute(
88         """
89         SELECT whatever
90           FROM some_table t
91          WHERE id = %s
92         """,
93         [value],
94     )
95     return cr.fetchone()
96
97
98 call(arg1, arg2, """
99 short
100 """, arg3=True)
101 test_vectors = [
102     "one-liner\n",
103     "two\nliner\n",
104     """expressed
105 as a three line
106 mulitline string""",
107 ]
108
109 _wat = re.compile(
110     r"""
111     regex
112     """,
113     re.MULTILINE | re.VERBOSE,
114 )
115 dis_c_instance_method = """\
116 %3d           0 LOAD_FAST                1 (x)
117               2 LOAD_CONST               1 (1)
118               4 COMPARE_OP               2 (==)
119               6 LOAD_FAST                0 (self)
120               8 STORE_ATTR               0 (x)
121              10 LOAD_CONST               0 (None)
122              12 RETURN_VALUE
123 """ % (_C.__init__.__code__.co_firstlineno + 1,)
124 path.write_text(textwrap.dedent("""\
125     A triple-quoted string
126     actually {verb} the textwrap.dedent functionality
127     that ends in a trailing newline,
128     representing e.g. {file_type} file contents.
129 """.format(verb="using", file_type="test")))
130 {"""cow
131 moos"""}
132 ["""cow
133 moos"""]
134 ["""cow
135 moos""", """dog
136 woofs
137 and
138 barks"""]
139 def dastardly_default_value(
140     cow: String = json.loads("""this
141 is
142 quite
143 the
144 dastadardly
145 value!"""),
146     **kwargs,
147 ):
148     pass
149
150 print(f"""
151     This {animal}
152     moos and barks
153 {animal} say
154 """)
155 msg = f"""The arguments {bad_arguments} were passed in.
156 Please use `--build-option` instead,
157 `--global-option` is reserved to flags like `--verbose` or `--quiet`.
158 """
159
160 this_will_become_one_line = (
161     "a"
162     "b"
163     "c"
164 )
165
166 this_will_stay_on_three_lines = (
167     "a"  # comment
168     "b"
169     "c"
170 )
171
172 this_will_also_become_one_line = (  # comment
173     "a"
174     "b"
175     "c"
176 )
177
178 # output
179 """cow
180 say""",
181 call(
182     3,
183     "dogsay",
184     textwrap.dedent("""dove
185     coo""" % "cowabunga"),
186 )
187 call(
188     3,
189     "dogsay",
190     textwrap.dedent("""dove
191 coo""" % "cowabunga"),
192 )
193 call(
194     3,
195     textwrap.dedent("""cow
196     moo""" % "cowabunga"),
197     "dogsay",
198 )
199 call(
200     3,
201     "dogsay",
202     textwrap.dedent("""crow
203     caw""" % "cowabunga"),
204 )
205 call(
206     3,
207     textwrap.dedent("""cat
208     meow""" % "cowabunga"),
209     {"dog", "say"},
210 )
211 call(
212     3,
213     {"dog", "say"},
214     textwrap.dedent("""horse
215     neigh""" % "cowabunga"),
216 )
217 call(
218     3,
219     {"dog", "say"},
220     textwrap.dedent("""pig
221     oink""" % "cowabunga"),
222 )
223 textwrap.dedent("""A one-line triple-quoted string.""")
224 textwrap.dedent("""A two-line triple-quoted string
225 since it goes to the next line.""")
226 textwrap.dedent("""A three-line triple-quoted string
227 that not only goes to the next line
228 but also goes one line beyond.""")
229 textwrap.dedent("""\
230     A triple-quoted string
231     actually leveraging the textwrap.dedent functionality
232     that ends in a trailing newline,
233     representing e.g. file contents.
234 """)
235 path.write_text(textwrap.dedent("""\
236     A triple-quoted string
237     actually leveraging the textwrap.dedent functionality
238     that ends in a trailing newline,
239     representing e.g. file contents.
240 """))
241 path.write_text(textwrap.dedent("""\
242     A triple-quoted string
243     actually leveraging the textwrap.dedent functionality
244     that ends in a trailing newline,
245     representing e.g. {config_filename} file contents.
246 """.format("config_filename", config_filename)))
247 # Another use case
248 data = yaml.load("""\
249 a: 1
250 b: 2
251 """)
252 data = yaml.load(
253     """\
254 a: 1
255 b: 2
256 """,
257 )
258 data = yaml.load("""\
259     a: 1
260     b: 2
261 """)
262
263 MULTILINE = """
264 foo
265 """.replace("\n", "")
266 generated_readme = lambda project_name: """
267 {}
268
269 <Add content here!>
270 """.strip().format(project_name)
271 parser.usage += """
272 Custom extra help summary.
273
274 Extra test:
275 - with
276 - bullets
277 """
278
279
280 def get_stuff(cr, value):
281     # original
282     cr.execute(
283         """
284         SELECT whatever
285           FROM some_table t
286          WHERE id = %s
287     """,
288         [value],
289     )
290     return cr.fetchone()
291
292
293 def get_stuff(cr, value):
294     # preferred
295     cr.execute(
296         """
297         SELECT whatever
298           FROM some_table t
299          WHERE id = %s
300         """,
301         [value],
302     )
303     return cr.fetchone()
304
305
306 call(
307     arg1,
308     arg2,
309     """
310 short
311 """,
312     arg3=True,
313 )
314 test_vectors = [
315     "one-liner\n",
316     "two\nliner\n",
317     """expressed
318 as a three line
319 mulitline string""",
320 ]
321
322 _wat = re.compile(
323     r"""
324     regex
325     """,
326     re.MULTILINE | re.VERBOSE,
327 )
328 dis_c_instance_method = """\
329 %3d           0 LOAD_FAST                1 (x)
330               2 LOAD_CONST               1 (1)
331               4 COMPARE_OP               2 (==)
332               6 LOAD_FAST                0 (self)
333               8 STORE_ATTR               0 (x)
334              10 LOAD_CONST               0 (None)
335              12 RETURN_VALUE
336 """ % (_C.__init__.__code__.co_firstlineno + 1,)
337 path.write_text(textwrap.dedent("""\
338     A triple-quoted string
339     actually {verb} the textwrap.dedent functionality
340     that ends in a trailing newline,
341     representing e.g. {file_type} file contents.
342 """.format(verb="using", file_type="test")))
343 {"""cow
344 moos"""}
345 ["""cow
346 moos"""]
347 [
348     """cow
349 moos""",
350     """dog
351 woofs
352 and
353 barks""",
354 ]
355
356
357 def dastardly_default_value(
358     cow: String = json.loads("""this
359 is
360 quite
361 the
362 dastadardly
363 value!"""),
364     **kwargs,
365 ):
366     pass
367
368
369 print(f"""
370     This {animal}
371     moos and barks
372 {animal} say
373 """)
374 msg = f"""The arguments {bad_arguments} were passed in.
375 Please use `--build-option` instead,
376 `--global-option` is reserved to flags like `--verbose` or `--quiet`.
377 """
378
379 this_will_become_one_line = "abc"
380
381 this_will_stay_on_three_lines = (
382     "a"  # comment
383     "b"
384     "c"
385 )
386
387 this_will_also_become_one_line = "abc"  # comment