File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 7
7
from tokenize_rt import Offset
8
8
9
9
from pyupgrade ._ast_helpers import ast_to_offset
10
+ from pyupgrade ._ast_helpers import has_starargs
10
11
from pyupgrade ._data import register
11
12
from pyupgrade ._data import State
12
13
from pyupgrade ._data import TokenFunc
@@ -59,7 +60,10 @@ def visit_Call(
59
60
isinstance (node .func , ast .Attribute ) and
60
61
isinstance (node .func .value , ast .Name ) and
61
62
node .func .value .id == 'unittest' and
62
- node .func .attr in FUNCTION_MAPPING
63
+ node .func .attr in FUNCTION_MAPPING and
64
+ not has_starargs (node ) and
65
+ not node .keywords and
66
+ len (node .args ) == 1
63
67
):
64
68
func = functools .partial (
65
69
replace_name ,
Original file line number Diff line number Diff line change 7
7
8
8
9
9
@pytest .mark .parametrize (
10
- ( 's' ,) ,
10
+ 's' ,
11
11
(
12
12
pytest .param (
13
13
'class ExampleTests:\n '
14
14
' def test_something(self):\n '
15
15
' self.assertEqual(1, 1)\n ' ,
16
16
id = 'not a deprecated alias' ,
17
17
),
18
+ 'unittest.makeSuite(Tests, "arg")' ,
19
+ 'unittest.makeSuite(Tests, prefix="arg")' ,
18
20
),
19
21
)
20
22
def test_fix_unittest_aliases_noop (s ):
You can’t perform that action at this time.
0 commit comments