@@ -95,7 +95,8 @@ def insert_pytest_raises() -> Generator[None, Any, int]:
9595 yield
9696 except Exception as e :
9797 python_code = format_code (
98- f'# with insert_pytest_raises():\n with pytest.raises({ type (e ).__name__ } , match=re.escape({ repr (str (e ))} )):\n '
98+ f'# with insert_pytest_raises():\n '
99+ f'with pytest.raises({ type (e ).__name__ } , match=re.escape({ repr (str (e ))} )):\n '
99100 )
100101 python_code = textwrap .indent (python_code , statement .col_offset * ' ' )
101102 to_replace .append (
@@ -215,19 +216,21 @@ def insert_assert_session(pytestconfig: pytest.Config) -> Generator[None, None,
215216 files += 1
216217 prefix = 'Printed' if print_instead else 'Replaced'
217218
218- insert_assert_count = len ([item for item in to_replace if item .instruction_type == " insert_assert" ])
219- insert_pytest_raises_count = len ([item for item in to_replace if item .instruction_type == " insert_pytest_raises" ])
219+ insert_assert_count = len ([item for item in to_replace if item .instruction_type == ' insert_assert' ])
220+ insert_pytest_raises_count = len ([item for item in to_replace if item .instruction_type == ' insert_pytest_raises' ])
220221 if insert_assert_count :
221222 summary .append (
222223 f'{ prefix } { insert_assert_count } insert_assert() call{ plural (to_replace )} in { files } file{ plural (files )} '
223224 )
224225 if insert_pytest_raises_count :
225226 summary .append (
226- f'{ prefix } { insert_pytest_raises_count } insert_pytest_raises() call{ plural (to_replace )} in { files } file{ plural (files )} '
227+ f'{ prefix } { insert_pytest_raises_count } insert_pytest_raises()'
228+ f' call{ plural (to_replace )} in { files } file{ plural (files )} '
227229 )
228230 if dup_count :
229231 summary .append (
230- f'\n { dup_count } insert{ plural (dup_count )} skipped because an assert statement on that line had already be inserted!'
232+ f'\n { dup_count } insert{ plural (dup_count )} '
233+ ' skipped because an assert statement on that line had already be inserted!'
231234 )
232235
233236 test_replacement_summary .set (summary )
0 commit comments