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

corona10 webhook-mailer at python.org
Wed Jan 26 05:05:56 EST 2022


https://github.com/python/cpython/commit/84f093918a4be663775afe2933f4be86f72fe495
commit: 84f093918a4be663775afe2933f4be86f72fe495
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-01-26T19:05:35+09:00
summary:

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

files:
M Lib/test/test_dis.py

diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index ee9729ebabf4a..c65b0143e87d0 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -1462,6 +1462,16 @@ def test__find_store_names(self):
                 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:



More information about the Python-checkins mailing list