ยปCore Development>Code coverage>Lib/test/test__opcode.py

Python code coverage for Lib/test/test__opcode.py

#countcontent
1n/aimport dis
2n/afrom test.support import import_module
3n/aimport unittest
4n/a
5n/a_opcode = import_module("_opcode")
6n/a
7n/aclass OpcodeTests(unittest.TestCase):
8n/a
9n/a def test_stack_effect(self):
10n/a self.assertEqual(_opcode.stack_effect(dis.opmap['POP_TOP']), -1)
11n/a self.assertEqual(_opcode.stack_effect(dis.opmap['DUP_TOP_TWO']), 2)
12n/a self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 0), -1)
13n/a self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 1), -1)
14n/a self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 3), -2)
15n/a self.assertRaises(ValueError, _opcode.stack_effect, 30000)
16n/a self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['BUILD_SLICE'])
17n/a self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['POP_TOP'], 0)
18n/a
19n/aif __name__ == "__main__":
20n/a unittest.main()