From 81387fe36e76438447ff2bddc36f4f5ff2c820a2 Mon Sep 17 00:00:00 2001 From: Juhi Chandalia Date: Fri, 28 Apr 2023 05:11:21 -0600 Subject: GH-103804: Add test for dis.disco (#103901) --- Lib/test/test_dis.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index bdb541e..5262c5c 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -881,6 +881,13 @@ class DisTests(DisTestBase): self.maxDiff = None got = self.get_disassembly(func, depth=0) self.do_disassembly_compare(got, expected, with_offsets) + # Add checks for dis.disco + if hasattr(func, '__code__'): + got_disco = io.StringIO() + with contextlib.redirect_stdout(got_disco): + dis.disco(func.__code__) + self.do_disassembly_compare(got_disco.getvalue(), expected, + with_offsets) def test_opmap(self): self.assertEqual(dis.opmap["NOP"], 9) -- cgit v0.12