]> 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:

Consistently wrap two context managers in parens (in --preview). (#3589)
[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 # output
135
136 from .config import (
137     Any,
138     Bool,
139     ConfigType,
140     ConfigTypeAttributes,
141     Int,
142     Path,
143     #  String,
144     #  resolve_to_config_type,
145     #  DEFAULT_TYPE_ATTRIBUTES,
146 )
147
148
149 from .config import (
150     Any,
151     Bool,
152     ConfigType,
153     ConfigTypeAttributes,
154     Int,
155     no_comma_here_yet,
156     #  and some comments,
157     #  resolve_to_config_type,
158     #  DEFAULT_TYPE_ATTRIBUTES,
159 )
160 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
161     MyLovelyCompanyTeamProjectComponent,  # NOT DRY
162 )
163 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
164     MyLovelyCompanyTeamProjectComponent as component,  # DRY
165 )
166
167
168 result = 1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
169
170 result = 1  # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
171
172 result = (  # aaa
173     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
174 )
175
176 result = (  # aaa
177     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
178 )
179
180
181 def func():
182     c = call(
183         0.0123,
184         0.0456,
185         0.0789,
186         0.0123,
187         0.0789,
188         a[-1],  # type: ignore
189     )
190     c = call(0.0123, 0.0456, 0.0789, 0.0123, 0.0789, a[-1])  # type: ignore
191     c = call(
192         0.0123,
193         0.0456,
194         0.0789,
195         0.0123,
196         0.0456,
197         0.0789,
198         0.0123,
199         0.0456,
200         0.0789,
201         a[-1],  # type: ignore
202     )
203
204     # The type: ignore exception only applies to line length, not
205     # other types of formatting.
206     c = call(
207         "aaaaaaaa",
208         "aaaaaaaa",
209         "aaaaaaaa",
210         "aaaaaaaa",
211         "aaaaaaaa",
212         "aaaaaaaa",  # type: ignore
213         "aaaaaaaa",
214         "aaaaaaaa",
215         "aaaaaaaa",
216         "aaaaaaaa",
217         "aaaaaaaa",
218         "aaaaaaaa",
219     )
220
221
222 class C:
223     @pytest.mark.parametrize(
224         ("post_data", "message"),
225         [
226             # metadata_version errors.
227             (
228                 {},
229                 (
230                     "None is an invalid value for Metadata-Version. Error: This field"
231                     " is required. see"
232                     " https://packaging.python.org/specifications/core-metadata"
233                 ),
234             ),
235             (
236                 {"metadata_version": "-1"},
237                 (
238                     "'-1' is an invalid value for Metadata-Version. Error: Unknown"
239                     " Metadata Version see"
240                     " https://packaging.python.org/specifications/core-metadata"
241                 ),
242             ),
243             # name errors.
244             (
245                 {"metadata_version": "1.2"},
246                 (
247                     "'' is an invalid value for Name. Error: This field is required."
248                     " see https://packaging.python.org/specifications/core-metadata"
249                 ),
250             ),
251             (
252                 {"metadata_version": "1.2", "name": "foo-"},
253                 (
254                     "'foo-' is an invalid value for Name. Error: Must start and end"
255                     " with a letter or numeral and contain only ascii numeric and '.',"
256                     " '_' and '-'. see"
257                     " https://packaging.python.org/specifications/core-metadata"
258                 ),
259             ),
260             # version errors.
261             (
262                 {"metadata_version": "1.2", "name": "example"},
263                 (
264                     "'' is an invalid value for Version. Error: This field is required."
265                     " see https://packaging.python.org/specifications/core-metadata"
266                 ),
267             ),
268             (
269                 {"metadata_version": "1.2", "name": "example", "version": "dog"},
270                 (
271                     "'dog' is an invalid value for Version. Error: Must start and end"
272                     " with a letter or numeral and contain only ascii numeric and '.',"
273                     " '_' and '-'. see"
274                     " https://packaging.python.org/specifications/core-metadata"
275                 ),
276             ),
277         ],
278     )
279     def test_fails_invalid_post_data(
280         self, pyramid_config, db_request, post_data, message
281     ):
282         ...
283
284
285 square = Square(4)  # type: Optional[Square]