| 1 | #!/usr/bin/env python2
 | 
| 2 | """
 | 
| 3 | pyvm2_test.py: Tests for pyvm2.py
 | 
| 4 | """
 | 
| 5 | 
 | 
| 6 | import unittest
 | 
| 7 | 
 | 
| 8 | import pyvm2  # module under test
 | 
| 9 | import pyobj
 | 
| 10 | 
 | 
| 11 | 
 | 
| 12 | def dummy():
 | 
| 13 |     return 1 + 2
 | 
| 14 | 
 | 
| 15 | 
 | 
| 16 | class 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 | 
 | 
| 30 | if __name__ == '__main__':
 | 
| 31 |   unittest.main()
 |