test_extension_interface.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Leics 作者: LeicsFrameWork 项目源码 文件源码
def test_setparent(self):
        def foo():
            def bar():
                greenlet.getcurrent().parent.switch()

                # This final switch should go back to the main greenlet, since
                # the test_setparent() function in the C extension should have
                # reparented this greenlet.
                greenlet.getcurrent().parent.switch()
                raise AssertionError("Should never have reached this code")
            child = greenlet.greenlet(bar)
            child.switch()
            greenlet.getcurrent().parent.switch(child)
            greenlet.getcurrent().parent.throw(
                AssertionError("Should never reach this code"))
        foo_child = greenlet.greenlet(foo).switch()
        self.assertEqual(None, _test_extension.test_setparent(foo_child))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号