Debian Codegraph @

tests/data/cases/preview_comments7.py

raw
1 # flags: --unstable
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 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 ]