def test_block_visitor(): co_simple = get_co(SIMPLE_PROGRAM) assert co_simple is not None bytecode_object = BytecodeObject('<string>') bytecode_object.parse_code(co_simple) class BlockPrinterVisitor(BlockVisitor): def __init__(self): BlockVisitor.__init__(self) def new_control_flow(self): logger.debug("Received new CFG: %s", self.control_flow) def visit(self, block): logger.debug("Visiting block: %s", block) logger.debug('\n' + show_bytecode(block.bytecode)) visitor = BlockPrinterVisitor() bytecode_object.accept(visitor)