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

Method test_source_line_in_disassembly

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

Source from the content-addressed store, hash-verified

2346 self.assertInstructionsEqual(list(actual), expected_opinfo_outer)
2347
2348 def test_source_line_in_disassembly(self):
2349 # Use the line in the source code
2350 actual = dis.Bytecode(simple).dis()
2351 actual = actual.strip().partition(" ")[0] # extract the line no
2352 expected = str(simple.__code__.co_firstlineno)
2353 self.assertEqual(actual, expected)
2354 # Use an explicit first line number
2355 actual = dis.Bytecode(simple, first_line=350).dis()
2356 actual = actual.strip().partition(" ")[0] # extract the line no
2357 self.assertEqual(actual, "350")
2358
2359 def test_info(self):
2360 self.maxDiff = 1000

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
disMethod · 0.80
partitionMethod · 0.45
stripMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected