mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-03 18:56:54 +00:00
fix debug statement hook to catch imports using a dundle method
This commit is contained in:
parent
31903eabdb
commit
c5a939b530
2 changed files with 11 additions and 0 deletions
|
|
@ -26,6 +26,12 @@ def test_finds_debug_import_from_import():
|
|||
assert visitor.breakpoints == [Debug(1, 0, 'pudb', 'imported')]
|
||||
|
||||
|
||||
def test_finds_debug_import_when_using_dunder_import():
|
||||
visitor = DebugStatementParser()
|
||||
visitor.visit(ast.parse('__import__("pdb").set_trace()'))
|
||||
assert visitor.breakpoints == [Debug(1, 0, 'pdb', 'imported')]
|
||||
|
||||
|
||||
def test_finds_breakpoint():
|
||||
visitor = DebugStatementParser()
|
||||
visitor.visit(ast.parse('breakpoint()'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue