OILS / opy / byterun / pyvm2_test.py View on Github | oilshell.org

31 lines, 16 significant
1#!/usr/bin/env python2
2"""
3pyvm2_test.py: Tests for pyvm2.py
4"""
5
6import unittest
7
8import pyvm2 # module under test
9import pyobj
10
11
12def dummy():
13 return 1 + 2
14
15
16class TestGuestException(unittest.TestCase):
17
18 def testGuestException(self):
19 co = dummy.__code__
20 back = None # Frame pointer
21
22 locals_ = globals()
23 globals_ = globals()
24
25 frames = [pyobj.Frame(co, globals_, locals_, back)]
26 g = pyvm2.GuestException(RuntimeError, 1, frames)
27 print(g)
28
29
30if __name__ == '__main__':
31 unittest.main()