提交 2405a21d 编写于 作者: B Ben Darnell

asyncio_test: Remove obsolete py3.4 compatibility

上级 78c2acb3
......@@ -44,15 +44,8 @@ class AsyncIOLoopTest(AsyncTestCase):
@gen_test
def test_asyncio_future(self):
# Test that we can yield an asyncio future from a tornado coroutine.
# Without 'yield from', we must wrap coroutines in ensure_future,
# which was introduced during Python 3.4, deprecating the prior "async".
if hasattr(asyncio, "ensure_future"):
ensure_future = asyncio.ensure_future
else:
# async is a reserved word in Python 3.7
ensure_future = getattr(asyncio, "async")
x = yield ensure_future(
# Without 'yield from', we must wrap coroutines in ensure_future.
x = yield asyncio.ensure_future(
asyncio.get_event_loop().run_in_executor(None, lambda: 42)
)
self.assertEqual(x, 42)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册