Skip to content

Commit 81387fe

Browse files
authored
GH-103804: Add test for dis.disco (#103901)
1 parent 30216b6 commit 81387fe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/test/test_dis.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,13 @@ def do_disassembly_test(self, func, expected, with_offsets=False):
881881
self.maxDiff = None
882882
got = self.get_disassembly(func, depth=0)
883883
self.do_disassembly_compare(got, expected, with_offsets)
884+
# Add checks for dis.disco
885+
if hasattr(func, '__code__'):
886+
got_disco = io.StringIO()
887+
with contextlib.redirect_stdout(got_disco):
888+
dis.disco(func.__code__)
889+
self.do_disassembly_compare(got_disco.getvalue(), expected,
890+
with_offsets)
884891

885892
def test_opmap(self):
886893
self.assertEqual(dis.opmap["NOP"], 9)

0 commit comments

Comments
 (0)