fix debug statement hook to catch imports using a dundle method

This commit is contained in:
Anderson Medeiros 2025-03-16 19:43:30 -03:00
parent 31903eabdb
commit c5a939b530
2 changed files with 11 additions and 0 deletions

View file

@ -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()'))