]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/black/tests/data/cases/preview_comments7.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_comments7.py
1 # flags: --preview
2 from .config import (
3     Any,
4     Bool,
5     ConfigType,
6     ConfigTypeAttributes,
7     Int,
8     Path,
9     #  String,
10     #  resolve_to_config_type,
11     #  DEFAULT_TYPE_ATTRIBUTES,
12 )
13
14
15 from .config import (
16     Any,
17     Bool,
18     ConfigType,
19     ConfigTypeAttributes,
20     Int,
21     no_comma_here_yet
22     #  and some comments,
23     #  resolve_to_config_type,
24     #  DEFAULT_TYPE_ATTRIBUTES,
25 )
26 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
27     MyLovelyCompanyTeamProjectComponent  # NOT DRY
28 )
29 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
30     MyLovelyCompanyTeamProjectComponent as component  # DRY
31 )
32
33
34 result = 1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
35
36 result = (
37     1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
38 )
39
40 result = (
41     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # aaa
42 )
43
44 result = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # aaa
45
46
47 def func():
48     c = call(
49         0.0123,
50         0.0456,
51         0.0789,
52         0.0123,
53         0.0789,
54         a[-1],  # type: ignore
55     )
56     c = call(
57         0.0123,
58         0.0456,
59         0.0789,
60         0.0123,
61         0.0789,
62         a[-1]  # type: ignore
63     )
64     c = call(
65         0.0123,
66         0.0456,
67         0.0789,
68         0.0123,
69         0.0456,
70         0.0789,
71         0.0123,
72         0.0456,
73         0.0789,
74         a[-1]  # type: ignore
75     )
76
77     # The type: ignore exception only applies to line length, not
78     # other types of formatting.
79     c = call(
80         "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa",  # type: ignore
81         "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa"
82     )
83
84
85 class C:
86     @pytest.mark.parametrize(
87         ("post_data", "message"),
88         [
89             # metadata_version errors.
90             (
91                 {},
92                 "None is an invalid value for Metadata-Version. Error: This field is"
93                 " required. see"
94                 " https://packaging.python.org/specifications/core-metadata"
95             ),
96             (
97                 {"metadata_version": "-1"},
98                 "'-1' is an invalid value for Metadata-Version. Error: Unknown Metadata"
99                 " Version see"
100                 " https://packaging.python.org/specifications/core-metadata"
101             ),
102             # name errors.
103             (
104                 {"metadata_version": "1.2"},
105                 "'' is an invalid value for Name. Error: This field is required. see"
106                 " https://packaging.python.org/specifications/core-metadata"
107             ),
108             (
109                 {"metadata_version": "1.2", "name": "foo-"},
110                 "'foo-' is an invalid value for Name. Error: Must start and end with a"
111                 " letter or numeral and contain only ascii numeric and '.', '_' and"
112                 " '-'. see https://packaging.python.org/specifications/core-metadata"
113             ),
114             # version errors.
115             (
116                 {"metadata_version": "1.2", "name": "example"},
117                 "'' is an invalid value for Version. Error: This field is required. see"
118                 " https://packaging.python.org/specifications/core-metadata"
119             ),
120             (
121                 {"metadata_version": "1.2", "name": "example", "version": "dog"},
122                 "'dog' is an invalid value for Version. Error: Must start and end with"
123                 " a letter or numeral and contain only ascii numeric and '.', '_' and"
124                 " '-'. see https://packaging.python.org/specifications/core-metadata"
125             )
126         ]
127     )
128     def test_fails_invalid_post_data(
129         self, pyramid_config, db_request, post_data, message
130     ):
131         ...
132
133 square = Square(4) # type: Optional[Square]
134
135 # Regression test for https://github.com/psf/black/issues/3756.
136 [
137     (
138         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
139     ),
140 ]
141 [
142     (  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
143         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
144     ),
145 ]
146
147 # output
148
149 from .config import (
150     Any,
151     Bool,
152     ConfigType,
153     ConfigTypeAttributes,
154     Int,
155     Path,
156     #  String,
157     #  resolve_to_config_type,
158     #  DEFAULT_TYPE_ATTRIBUTES,
159 )
160
161
162 from .config import (
163     Any,
164     Bool,
165     ConfigType,
166     ConfigTypeAttributes,
167     Int,
168     no_comma_here_yet,
169     #  and some comments,
170     #  resolve_to_config_type,
171     #  DEFAULT_TYPE_ATTRIBUTES,
172 )
173 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
174     MyLovelyCompanyTeamProjectComponent,  # NOT DRY
175 )
176 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
177     MyLovelyCompanyTeamProjectComponent as component,  # DRY
178 )
179
180
181 result = 1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
182
183 result = 1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
184
185 result = (  # aaa
186     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
187 )
188
189 result = (  # aaa
190     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
191 )
192
193
194 def func():
195     c = call(
196         0.0123,
197         0.0456,
198         0.0789,
199         0.0123,
200         0.0789,
201         a[-1],  # type: ignore
202     )
203     c = call(0.0123, 0.0456, 0.0789, 0.0123, 0.0789, a[-1])  # type: ignore
204     c = call(
205         0.0123,
206         0.0456,
207         0.0789,
208         0.0123,
209         0.0456,
210         0.0789,
211         0.0123,
212         0.0456,
213         0.0789,
214         a[-1],  # type: ignore
215     )
216
217     # The type: ignore exception only applies to line length, not
218     # other types of formatting.
219     c = call(
220         "aaaaaaaa",
221         "aaaaaaaa",
222         "aaaaaaaa",
223         "aaaaaaaa",
224         "aaaaaaaa",
225         "aaaaaaaa",  # type: ignore
226         "aaaaaaaa",
227         "aaaaaaaa",
228         "aaaaaaaa",
229         "aaaaaaaa",
230         "aaaaaaaa",
231         "aaaaaaaa",
232     )
233
234
235 class C:
236     @pytest.mark.parametrize(
237         ("post_data", "message"),
238         [
239             # metadata_version errors.
240             (
241                 {},
242                 (
243                     "None is an invalid value for Metadata-Version. Error: This field"
244                     " is required. see"
245                     " https://packaging.python.org/specifications/core-metadata"
246                 ),
247             ),
248             (
249                 {"metadata_version": "-1"},
250                 (
251                     "'-1' is an invalid value for Metadata-Version. Error: Unknown"
252                     " Metadata Version see"
253                     " https://packaging.python.org/specifications/core-metadata"
254                 ),
255             ),
256             # name errors.
257             (
258                 {"metadata_version": "1.2"},
259                 (
260                     "'' is an invalid value for Name. Error: This field is required."
261                     " see https://packaging.python.org/specifications/core-metadata"
262                 ),
263             ),
264             (
265                 {"metadata_version": "1.2", "name": "foo-"},
266                 (
267                     "'foo-' is an invalid value for Name. Error: Must start and end"
268                     " with a letter or numeral and contain only ascii numeric and '.',"
269                     " '_' and '-'. see"
270                     " https://packaging.python.org/specifications/core-metadata"
271                 ),
272             ),
273             # version errors.
274             (
275                 {"metadata_version": "1.2", "name": "example"},
276                 (
277                     "'' is an invalid value for Version. Error: This field is required."
278                     " see https://packaging.python.org/specifications/core-metadata"
279                 ),
280             ),
281             (
282                 {"metadata_version": "1.2", "name": "example", "version": "dog"},
283                 (
284                     "'dog' is an invalid value for Version. Error: Must start and end"
285                     " with a letter or numeral and contain only ascii numeric and '.',"
286                     " '_' and '-'. see"
287                     " https://packaging.python.org/specifications/core-metadata"
288                 ),
289             ),
290         ],
291     )
292     def test_fails_invalid_post_data(
293         self, pyramid_config, db_request, post_data, message
294     ): ...
295
296
297 square = Square(4)  # type: Optional[Square]
298
299 # Regression test for https://github.com/psf/black/issues/3756.
300 [
301     (  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
302         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
303     ),
304 ]
305 [
306     (  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
307         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
308     ),
309 ]