Skip to content

Commit 13cea53

Browse files
committed
Add new test case
1 parent 9cdc231 commit 13cea53

File tree

7 files changed

+65
-18
lines changed

7 files changed

+65
-18
lines changed

tests/fixtures/comment_3.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"""Comment will be changed. Only valid with '--force'."""
22
import sys
3-
from typing import Any, List, Union
4-
5-
# This is a comment
6-
from xyz import not_exist
7-
3+
from typing import ( # this comment should not be deleted
4+
Any, List, Union)
85

96
var: Any = sys.version
107
var2: List[int]

tests/fixtures/comment_3_forced.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
import sys
55
from typing import Any
66

7-
from xyz import not_exist
8-
9-
# This is a comment
10-
11-
127
var: Any = sys.version
138
var2: list[int]
149

tests/fixtures/comment_3_no_change.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"""Comment will be changed. Only valid with '--force'."""
22
import sys
3-
from typing import Any, List, Union
4-
5-
# This is a comment
6-
from xyz import not_exist
7-
3+
from typing import ( # this comment should not be deleted
4+
Any, List, Union)
85

96
var: Any = sys.version
107
var2: List[int]

tests/fixtures/comment_4.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Comment will be changed. Only valid with '--force'."""
2+
import sys
3+
from typing import Any, List, Union
4+
5+
# This is a comment
6+
from xyz import not_exist
7+
8+
var: Any = sys.version
9+
var2: List[int]
10+
11+
12+
def func(
13+
arg: Union[int, str],
14+
) -> List[int]:
15+
pass

tests/fixtures/comment_4_forced.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Comment will be changed. Only valid with '--force'."""
2+
from __future__ import annotations
3+
4+
import sys
5+
from typing import Any
6+
7+
from xyz import not_exist
8+
9+
# This is a comment
10+
11+
var: Any = sys.version
12+
var2: list[int]
13+
14+
15+
def func(
16+
arg: int | str,
17+
) -> list[int]:
18+
pass
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Comment will be changed. Only valid with '--force'."""
2+
import sys
3+
from typing import Any, List, Union
4+
5+
# This is a comment
6+
from xyz import not_exist
7+
8+
var: Any = sys.version
9+
var2: List[int]
10+
11+
12+
def func(
13+
arg: Union[int, str],
14+
) -> List[int]:
15+
pass

tests/test_main.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,31 @@ async def async_restore_fixtures(file_list: list[str]) -> AsyncGenerator[None, N
106106
None, 2,
107107
id="23_comment_3_no_change",
108108
),
109+
pytest.param(
110+
'comment_4.py', 'comment_4_no_change.py',
111+
None, 2,
112+
id="24_comment_4_no_change",
113+
),
109114
pytest.param(
110115
'comment_1.py', 'comment_1_forced.py',
111116
['--force'], 2,
112-
id="24_comment_1_forced",
117+
id="25_comment_1_forced",
113118
marks=pytest.mark.xfail(reason="Not implemented yet")
114119
),
115120
pytest.param(
116121
'comment_2.py', 'comment_2_forced.py',
117122
['--force'], 2,
118-
id="25_comment_2_forced",
123+
id="26_comment_2_forced",
119124
),
120125
pytest.param(
121126
'comment_3.py', 'comment_3_forced.py',
122127
['--force'], 2,
123-
id="26_comment_3_forced",
128+
id="27_comment_3_forced",
129+
),
130+
pytest.param(
131+
'comment_4.py', 'comment_4_forced.py',
132+
['--force'], 2,
133+
id="28_comment_4_forced",
124134
),
125135
pytest.param(
126136
'comment_no_issue_1.py', 'comment_no_issue_1_fixed.py',

0 commit comments

Comments
 (0)