concurrent_test.py 文件源码

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

项目:ProgrameFacil 作者: Gpzim98 项目源码 文件源码
def test_call_with_both(self):
        class Object(object):
            def __init__(self, io_loop):
                self._io_loop = io_loop
                self.__executor = futures.thread.ThreadPoolExecutor(1)

            @run_on_executor(io_loop='_io_loop', executor='_Object__executor')
            def f(self):
                return 42

        o = Object(io_loop=self.io_loop)
        answer = yield o.f()
        self.assertEqual(answer, 42)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号