You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
450 B

3 years ago
import greenlet
import unittest
class Test(unittest.TestCase):
def test_stack_saved(self):
main = greenlet.getcurrent()
self.assertEqual(main._stack_saved, 0)
def func():
main.switch(main._stack_saved)
g = greenlet.greenlet(func)
x = g.switch()
assert x > 0, x
assert g._stack_saved > 0, g._stack_saved
g.switch()
assert g._stack_saved == 0, g._stack_saved