diff options
author | Juhi Chandalia <jkchandalia@gmail.com> | 2023-04-28 11:11:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 11:11:21 (GMT) |
commit | 81387fe36e76438447ff2bddc36f4f5ff2c820a2 (patch) | |
tree | 20b1b9b5757c3930f9df109600ed3f3324f04ee6 | |
parent | 30216b69a2fc716c7cfab842364a379cd6ffe458 (diff) | |
download | cpython-81387fe36e76438447ff2bddc36f4f5ff2c820a2.zip cpython-81387fe36e76438447ff2bddc36f4f5ff2c820a2.tar.gz cpython-81387fe36e76438447ff2bddc36f4f5ff2c820a2.tar.bz2 |
GH-103804: Add test for dis.disco (#103901)
-rw-r--r-- | Lib/test/test_dis.py | 7 |
1 files changed, 7 insertions, 0 deletions
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) |