mirror of
https://github.com/python/cpython.git
synced 2026-03-20 20:01:16 +00:00
GH-103804: Add test for dis.disco (#103901)
This commit is contained in:
parent
30216b69a2
commit
81387fe36e
1 changed files with 7 additions and 0 deletions
|
|
@ -881,6 +881,13 @@ def do_disassembly_test(self, func, expected, with_offsets=False):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue