bpo-45578: add a test case for `dis.findlabels` (GH-30058)

This commit is contained in:
Nikita Sobolev 2022-01-26 13:05:35 +03:00 committed by GitHub
parent 6e5a193816
commit 84f093918a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -1462,6 +1462,16 @@ class TestFinderMethods(unittest.TestCase):
res = tuple(dis._find_store_names(code))
self.assertEqual(res, expected)
def test_findlabels(self):
labels = dis.findlabels(jumpy.__code__.co_code)
jumps = [
instr.offset
for instr in expected_opinfo_jumpy
if instr.is_jump_target
]
self.assertEqual(sorted(labels), sorted(jumps))
class TestDisTraceback(unittest.TestCase):
def setUp(self) -> None: