]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
asyncio_test: Remove obsolete py3.4 compatibility 3284/head
authorBen Darnell <ben@bendarnell.com>
Mon, 19 Jun 2023 19:30:48 +0000 (15:30 -0400)
committerBen Darnell <ben@bendarnell.com>
Mon, 19 Jun 2023 19:34:00 +0000 (15:34 -0400)
tornado/test/asyncio_test.py

index 4eda9395c88bcdc30abd24a334b8bbef13ba826e..bb6416a549f3dfb8e9f084087de10cebd3faa246 100644 (file)
@@ -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)