mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
python-3.6.zip added from Github
README.cosmo contains the necessary links.
This commit is contained in:
parent
75fc601ff5
commit
0c4c56ff39
4219 changed files with 1968626 additions and 0 deletions
20
third_party/python/Lib/test/test__opcode.py
vendored
Normal file
20
third_party/python/Lib/test/test__opcode.py
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
import dis
|
||||
from test.support import import_module
|
||||
import unittest
|
||||
|
||||
_opcode = import_module("_opcode")
|
||||
|
||||
class OpcodeTests(unittest.TestCase):
|
||||
|
||||
def test_stack_effect(self):
|
||||
self.assertEqual(_opcode.stack_effect(dis.opmap['POP_TOP']), -1)
|
||||
self.assertEqual(_opcode.stack_effect(dis.opmap['DUP_TOP_TWO']), 2)
|
||||
self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 0), -1)
|
||||
self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 1), -1)
|
||||
self.assertEqual(_opcode.stack_effect(dis.opmap['BUILD_SLICE'], 3), -2)
|
||||
self.assertRaises(ValueError, _opcode.stack_effect, 30000)
|
||||
self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['BUILD_SLICE'])
|
||||
self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['POP_TOP'], 0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue