Skip to content

Commit

Permalink
add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Jan 15, 2024
1 parent 0429aba commit 0c20afc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/codemods/test_combine_startswith_endswith.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ def test_combine(self, tmpdir, func):
def test_no_change(self, tmpdir, code):
self.run_and_assert(tmpdir, code, code)
assert len(self.file_context.codemod_changes) == 0

def test_exclude_line(self, tmpdir):
input_code = expected = f"""\
x = "foo"
x.startswith("foo") or x.startswith("f")
"""
lines_to_exclude = [2]
self.assert_no_change_line_excluded(
tmpdir, input_code, expected, lines_to_exclude
)
10 changes: 10 additions & 0 deletions tests/codemods/test_remove_debug_breakpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,13 @@ def something():
"""
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_exclude_line(self, tmpdir):
input_code = expected = f"""\
x = "foo"
breakpoint()
"""
lines_to_exclude = [2]
self.assert_no_change_line_excluded(
tmpdir, input_code, expected, lines_to_exclude
)
10 changes: 10 additions & 0 deletions tests/codemods/test_subprocess_shell_false.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ def test_shell_False(self, tmpdir, func):
"""
self.run_and_assert(tmpdir, input_code, input_code)
assert len(self.file_context.codemod_changes) == 0

def test_exclude_line(self, tmpdir):
input_code = expected = """\
import subprocess
subprocess.run(args, shell=True)
"""
lines_to_exclude = [2]
self.assert_no_change_line_excluded(
tmpdir, input_code, expected, lines_to_exclude
)

0 comments on commit 0c20afc

Please sign in to comment.