Skip to content

Commit

Permalink
Removed includes/excludes check and test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecsilva committed Jan 22, 2024
1 parent 3b01bb1 commit 2c094e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
6 changes: 2 additions & 4 deletions src/core_codemods/remove_assertion_in_pytest_raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ def leave_With(
) -> Union[
cst.BaseStatement, cst.FlattenSentinel[cst.BaseStatement], cst.RemovalSentinel
]:
if not self.filter_by_path_includes_or_excludes(
self.node_position(original_node)
):
return updated_node
# TODO: add filter by include or exclude that works for nodes
# that that have different start/end numbers.

# Are all items pytest.raises?
if not self._all_pytest_raises(original_node):
Expand Down
16 changes: 0 additions & 16 deletions tests/codemods/test_remove_assertion_in_pytest_raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,3 @@ def foo():
1/0
"""
self.run_and_assert(tmpdir, input_code, input_code)

def test_exclude_line(self, tmpdir):
input_code = expected = """\
import pytest
def foo():
with pytest.raises(ZeroDivisionError), open('') as file:
1/0
assert True
"""
lines_to_exclude = [2]
self.run_and_assert(
tmpdir,
input_code,
expected,
lines_to_exclude=lines_to_exclude,
)

0 comments on commit 2c094e8

Please sign in to comment.