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

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