MCPcopy Index your code
hub / github.com/python/cpython / test_dis_with_some_positions

Method test_dis_with_some_positions

Lib/test/test_dis.py:1075–1100  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1073
1074 @requires_debug_ranges()
1075 def test_dis_with_some_positions(self):
1076 code = ("def f():\n"
1077 " try: pass\n"
1078 " finally:pass")
1079 f = compile(ast.parse(code), "?", "exec").co_consts[0]
1080
1081 expect = '\n'.join([
1082 '1:0-1:0 RESUME 0',
1083 '',
1084 '2:3-3:15 NOP',
1085 '',
1086 '3:11-3:15 LOAD_CONST 0 (None)',
1087 '3:11-3:15 RETURN_VALUE',
1088 '',
1089 ' -- L1: PUSH_EXC_INFO',
1090 '',
1091 '3:11-3:15 RERAISE 0',
1092 '',
1093 ' -- L2: COPY 3',
1094 ' -- POP_EXCEPT',
1095 ' -- RERAISE 1',
1096 'ExceptionTable:',
1097 ' L1 to L2 -> L2 [1] lasti',
1098 '',
1099 ])
1100 self.do_disassembly_test(f, expect, show_positions=True)
1101
1102 @requires_debug_ranges()
1103 def test_dis_with_linenos_but_no_columns(self):

Callers

nothing calls this directly

Calls 4

do_disassembly_testMethod · 0.95
compileFunction · 0.50
parseMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected