Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Jan 2, 2024
1 parent 24d1a21 commit 1f5ea7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ repos:
src/core_codemods/docs/.*|
src/codemodder/dependency.py |
integration_tests/.*|
tests/codemods/test_remove_debug_breakpoint.py |
tests/test_codemodder.py
tests/.*
)$
- id: check-added-large-files
- repo: https://github.com/psf/black
Expand Down
5 changes: 5 additions & 0 deletions src/core_codemods/remove_debug_breakpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class RemoveDebugBreakpoint(BaseCodemod, NameResolutionMixin, AncestorPatternsMi
def leave_Expr(
self, original_node: cst.Expr, _
) -> Union[cst.Expr, cst.RemovalSentinel]:
if not self.filter_by_path_includes_or_excludes(
self.node_position(original_node)
):
return original_node

Check warning on line 20 in src/core_codemods/remove_debug_breakpoint.py

View check run for this annotation

Codecov / codecov/patch

src/core_codemods/remove_debug_breakpoint.py#L20

Added line #L20 was not covered by tests

match call_node := original_node.value:
case cst.Call():
if self.find_base_name(
Expand Down
11 changes: 5 additions & 6 deletions tests/codemods/test_remove_debug_breakpoint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from core_codemods.remove_debug_breakpoint import RemoveDebugBreakpoint
from tests.codemods.base_codemod_test import BaseCodemodTest
from textwrap import dedent


class TestRemoveDebugBreakpoint(BaseCodemodTest):
Expand All @@ -21,7 +20,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_builtin_breakpoint_multiple_statements(self, tmpdir):
Expand All @@ -37,7 +36,7 @@ def something():
print(var);
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_inline_pdb(self, tmpdir):
Expand All @@ -52,7 +51,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_pdb_import(self, tmpdir):
Expand All @@ -68,7 +67,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_pdb_from_import(self, tmpdir):
Expand All @@ -84,5 +83,5 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

0 comments on commit 1f5ea7e

Please sign in to comment.