Skip to content

Commit dd659aa

Browse files
committed
More tests
1 parent 5eed5b5 commit dd659aa

File tree

5 files changed

+50
-64
lines changed

5 files changed

+50
-64
lines changed

Diff for: tests/data/miscellaneous/long_strings_flag_disabled.py

-5
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@ def foo():
276276

277277
x = f"This is a {{really}} long string that needs to be split without a doubt (i.e. most definitely). In short, this {string} that can't possibly be {{expected}} to fit all together on one line. In {fact} it may even take up three or more lines... like four or five... but probably just four."
278278

279-
long_unmergable_string_with_pragma = (
280-
"This is a really long string that can't be merged because it has a likely pragma at the end" # pyright: ignore[reportGeneralTypeIssues]
281-
" of it."
282-
)
283-
284279
long_unmergable_string_with_pragma = (
285280
"This is a really long string that can't be merged because it has a likely pragma at the end" # type: ignore
286281
" of it."

Diff for: tests/data/preview/comments7.py

+16-46
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
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,
1+
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
2+
MyLovelyCompanyTeamProjectComponent, # NOT DRY
3+
)
4+
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
5+
MyLovelyCompanyTeamProjectComponent as component, # DRY
116
)
127

13-
14-
from .config import (
8+
from .config import ( # String,; resolve_to_config_type,; DEFAULT_TYPE_ATTRIBUTES,; and some comments,
159
Any,
1610
Bool,
1711
ConfigType,
1812
ConfigTypeAttributes,
1913
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
14+
Path,
15+
no_comma_here_yet,
3016
)
3117

32-
3318
result = 1 # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3419

3520
result = (
@@ -133,38 +118,23 @@ def test_fails_invalid_post_data(
133118

134119
# output
135120

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,
121+
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
122+
MyLovelyCompanyTeamProjectComponent, # NOT DRY
123+
)
124+
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
125+
MyLovelyCompanyTeamProjectComponent as component, # DRY
146126
)
147127

148-
149-
from .config import (
128+
from .config import ( # String,; resolve_to_config_type,; DEFAULT_TYPE_ATTRIBUTES,; and some comments,
150129
Any,
151130
Bool,
152131
ConfigType,
153132
ConfigTypeAttributes,
154133
Int,
134+
Path,
155135
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
165136
)
166137

167-
168138
result = 1 # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
169139

170140
result = 1 # look ma, no comment migration xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -187,8 +157,8 @@ def func():
187157
0.0789,
188158
a[-1], # type: ignore
189159
)
190-
c = call(0.0123, 0.0456, 0.0789, 0.0123, 0.0789, a[-1]) # type: ignore
191160
c = call(0.0123, 0.0456, 0.0789, 0.0123, 0.0789, a[-1]) # pyright: ignore[reportGeneralTypeIssues]
161+
c = call(0.0123, 0.0456, 0.0789, 0.0123, 0.0789, a[-1]) # type: ignore
192162
c = call(
193163
0.0123,
194164
0.0456,

Diff for: tests/data/preview/long_strings.py

-5
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,6 @@ def foo():
231231

232232
x = f"This is a {{really}} long string that needs to be split without a doubt (i.e. most definitely). In short, this {string} that can't possibly be {{expected}} to fit all together on one line. In {fact} it may even take up three or more lines... like four or five... but probably just four."
233233

234-
long_unmergable_string_with_pragma = (
235-
"This is a really long string that can't be merged because it has a likely pragma at the end" # pyright: ignore[reportGeneralTypeIssues]
236-
" of it."
237-
)
238-
239234
long_unmergable_string_with_pragma = (
240235
"This is a really long string that can't be merged because it has a likely pragma at the end" # type: ignore
241236
" of it."

Diff for: tests/data/preview/prefer_rhs_split.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,31 @@
5555
)
5656

5757

58-
# Make sure unsplittable type ignore won't be moved.
59-
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
58+
# Make sure unsplittable pyright: ignore comments won't be moved.
59+
some_kind_of_table[some_key] = util.some_function( # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
6060
some_arg
6161
).intersection(pk_cols)
6262

6363
some_kind_of_table[
6464
some_key
65-
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
65+
] = lambda obj: obj.some_long_named_method() # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
6666

6767
some_kind_of_table[
68-
some_key # type: ignore # noqa: E501
68+
some_key # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
6969
] = lambda obj: obj.some_long_named_method()
7070

7171

72-
# Make sure unsplittable pyright: ignore comments won't be moved.
73-
some_kind_of_table[some_key] = util.some_function( # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
72+
# Make sure unsplittable type ignore won't be moved.
73+
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501
7474
some_arg
7575
).intersection(pk_cols)
7676

7777
some_kind_of_table[
7878
some_key
79-
] = lambda obj: obj.some_long_named_method() # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
79+
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501
8080

8181
some_kind_of_table[
82-
some_key # pyright: ignore[reportGeneralTypeIssues] # noqa: E501
82+
some_key # type: ignore # noqa: E501
8383
] = lambda obj: obj.some_long_named_method()
8484

8585

Diff for: tests/data/simple_cases/comments6.py

+26
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ def f(
8686
def func(
8787
a=some_list[0], # type: int
8888
): # type: () -> int
89+
c = call(
90+
0.0123,
91+
0.0456,
92+
0.0789,
93+
0.0123,
94+
0.0456,
95+
0.0789,
96+
0.0123,
97+
0.0456,
98+
0.0789,
99+
a[-1], # pyright: ignore[reportGeneralTypeIssues]
100+
)
101+
89102
c = call(
90103
0.0123,
91104
0.0456,
@@ -99,6 +112,10 @@ def func(
99112
a[-1], # type: ignore
100113
)
101114

115+
c = call(
116+
"aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa" # pyright: ignore[reportGeneralTypeIssues]
117+
)
118+
102119
c = call(
103120
"aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa", "aaaaaaaa" # type: ignore
104121
)
@@ -108,11 +125,20 @@ def func(
108125
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
109126
)
110127

128+
AAAAAAAAAAAAA = [AAAAAAAAAAAAA] + SHARED_AAAAAAAAAAAAA + USER_AAAAAAAAAAAAA + AAAAAAAAAAAAA # pyright: ignore[reportGeneralTypeIssues]
129+
111130
AAAAAAAAAAAAA = [AAAAAAAAAAAAA] + SHARED_AAAAAAAAAAAAA + USER_AAAAAAAAAAAAA + AAAAAAAAAAAAA # type: ignore
112131

132+
call_to_some_function_asdf(
133+
foo,
134+
[AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBB], # pyright: ignore[reportGeneralTypeIssues]
135+
)
136+
113137
call_to_some_function_asdf(
114138
foo,
115139
[AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBB], # type: ignore
116140
)
117141

142+
aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*items))) # pyright: ignore[reportGeneralTypeIssues]
143+
118144
aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*items))) # type: ignore[arg-type]

0 commit comments

Comments
 (0)