gh-128891: add specialized opcodes to opcode.opname (#128892)

This commit is contained in:
Irit Katriel 2025-01-15 21:02:32 +00:00 committed by GitHub
parent 256d6d2131
commit 5eee2fe2b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 4 deletions

View file

@ -38,6 +38,13 @@ class OpListTests(unittest.TestCase):
opcodes = [dis.opmap[opname] for opname in names]
self.check_bool_function_result(_opcode.is_valid, opcodes, True)
def test_opmaps(self):
def check_roundtrip(name, map):
return self.assertEqual(opcode.opname[map[name]], name)
check_roundtrip('BINARY_OP', opcode.opmap)
check_roundtrip('BINARY_OP_ADD_INT', opcode._specialized_opmap)
def test_oplists(self):
def check_function(self, func, expected):
for op in [-10, 520]: