Skip to content

Commit 121cffb

Browse files
committed
Merge branch 'main' of https://github.com/dannysepler/pytestify into main
2 parents d037bd4 + 78a16ce commit 121cffb

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

pytestify/fixes/asserts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ def visit_Call(self, call: ast.Call) -> None:
148148
find_outer_comma(operators, comma_no=2),
149149
]
150150
close_paren = find_closing_paren(open_paren, operators)
151+
if commas[1] and commas[1].line > close_paren.line:
152+
commas[1] = None
153+
151154
kwargs = {}
152155
for keyword in call.keywords or []:
153156
if keyword.arg in ['places', 'delta']:

tests/fixes/test_asserts.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ def test_rewrite_simple_asserts(before, after):
165165
" 'a': 1,\n"
166166
'}',
167167
),
168+
(
169+
'self.assertIsInstance(x, y)\n'
170+
'self.assertIsInstance(x, y)',
171+
'assert isinstance(x, y)\n'
172+
'assert isinstance(x, y)',
173+
),
168174
],
169175
)
170176
def test_rewrite_complex_asserts(before, after):

0 commit comments

Comments
 (0)