1
1
"""Test the format_ignores module."""
2
2
3
- # ruff: noqa: PLC2701
4
3
import errno
5
4
import sys
6
5
from pathlib import Path
@@ -41,7 +40,7 @@ def test_process_file(tmpdir: pytest.TempdirFactory) -> None:
41
40
pass
42
41
43
42
def func2() -> None:
44
- # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
43
+ # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
45
44
pass
46
45
"""
47
46
test_file .write_text (test_content , encoding = "utf-8" )
@@ -95,15 +94,15 @@ def test_process_directory(tmpdir: pytest.TempdirFactory) -> None:
95
94
encoding = "utf-8" ,
96
95
)
97
96
test_files [2 ].write_text (
98
- "# pyright: ignore[reportUnknownVariableType, reportUnknownMemberType]" ,
97
+ "# pyright: ignore[reportUnknownMemberType, reportUnknownVariableType ]" ,
99
98
encoding = "utf-8" ,
100
99
)
101
100
test_files [3 ].write_text (
102
- "# type: ignore[no-any-return, attr-defined ]" ,
101
+ "# type: ignore[attr-defined, no-any-return]" ,
103
102
encoding = "utf-8" ,
104
103
)
105
104
test_files [4 ].write_text (
106
- "# type: ignore[no-any-return, attr-defined ]" ,
105
+ "# type: ignore[attr-defined, no-any-return]" ,
107
106
encoding = "utf-8" ,
108
107
)
109
108
@@ -138,11 +137,11 @@ def test_process_directory(tmpdir: pytest.TempdirFactory) -> None:
138
137
)
139
138
assert (
140
139
test_files [3 ].read_text (encoding = "utf-8" )
141
- == "# type: ignore[no-any-return, attr-defined ]"
140
+ == "# type: ignore[attr-defined, no-any-return]"
142
141
)
143
142
assert (
144
143
test_files [4 ].read_text (encoding = "utf-8" )
145
- == "# type: ignore[no-any-return, attr-defined ]"
144
+ == "# type: ignore[attr-defined, no-any-return]"
146
145
)
147
146
148
147
@@ -153,7 +152,7 @@ def test_main_success(
153
152
"""Test main function with valid path."""
154
153
test_file = Path (str (tmpdir )) / "test.pyi"
155
154
test_file .write_text (
156
- "# type: ignore[no-any-return, attr-defined ]" ,
155
+ "# type: ignore[attr-defined, no-any-return]" ,
157
156
encoding = "utf-8" ,
158
157
)
159
158
@@ -175,7 +174,7 @@ def test_main_check_mode(
175
174
"""Test main function in check-only mode."""
176
175
test_file = Path (str (tmpdir )) / "test.pyi"
177
176
test_file .write_text (
178
- "# type: ignore[no-any-return, attr-defined ]" ,
177
+ "# type: ignore[attr-defined, no-any-return]" ,
179
178
encoding = "utf-8" ,
180
179
)
181
180
@@ -186,7 +185,7 @@ def test_main_check_mode(
186
185
187
186
assert (
188
187
test_file .read_text (encoding = "utf-8" )
189
- == "# type: ignore[no-any-return, attr-defined ]"
188
+ == "# type: ignore[attr-defined, no-any-return]"
190
189
)
191
190
192
191
@@ -206,7 +205,7 @@ def test_main_custom_pattern(
206
205
"""Test main function with custom pattern."""
207
206
temp_dir = Path (str (tmpdir ))
208
207
test_py = temp_dir / "test.py"
209
- test_py .write_text ("# type: ignore[no-any-return, attr-defined ]" , encoding = "utf-8" )
208
+ test_py .write_text ("# type: ignore[attr-defined, no-any-return]" , encoding = "utf-8" )
210
209
211
210
monkeypatch .setattr (
212
211
sys ,
0 commit comments