test_cpp.py 488 B

123456789101112131415161718
  1. from __future__ import print_function
  2. from __future__ import absolute_import
  3. import unittest
  4. import greenlet
  5. from . import _test_extension_cpp
  6. class CPPTests(unittest.TestCase):
  7. def test_exception_switch(self):
  8. greenlets = []
  9. for i in range(4):
  10. g = greenlet.greenlet(_test_extension_cpp.test_exception_switch)
  11. g.switch(i)
  12. greenlets.append(g)
  13. for i, g in enumerate(greenlets):
  14. self.assertEqual(g.switch(), i)