diff options
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 323c090..3fbb2a1 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2660,7 +2660,7 @@ class CTask_Future_Tests(test_utils.TestCase): try: fut = Fut(loop=self.loop) self.loop.call_later(0.1, fut.set_result, 1) - task = asyncio.Task(coro(), loop=self.loop) + task = self.loop.create_task(coro()) res = self.loop.run_until_complete(task) finally: self.loop.close() @@ -2878,7 +2878,7 @@ class GatherTestsBase: test_utils.run_briefly(loop) def _check_success(self, **kwargs): - a, b, c = [asyncio.Future(loop=self.one_loop) for i in range(3)] + a, b, c = [self.one_loop.create_future() for i in range(3)] fut = asyncio.gather(*self.wrap_futures(a, b, c), **kwargs) cb = test_utils.MockCallback() fut.add_done_callback(cb) @@ -2900,7 +2900,7 @@ class GatherTestsBase: self._check_success(return_exceptions=True) def test_one_exception(self): - a, b, c, d, e = [asyncio.Future(loop=self.one_loop) for i in range(5)] + a, b, c, d, e = [self.one_loop.create_future() for i in range(5)] fut = asyncio.gather(*self.wrap_futures(a, b, c, d, e)) cb = test_utils.MockCallback() fut.add_done_callback(cb) @@ -2918,7 +2918,7 @@ class GatherTestsBase: e.exception() def test_return_exceptions(self): - a, b, c, d = [asyncio.Future(loop=self.one_loop) for i in range(4)] + a, b, c, d = [self.one_loop.create_future() for i in range(4)] fut = asyncio.gather(*self.wrap_futures(a, b, c, d), return_exceptions=True) cb = test_utils.MockCallback() @@ -2991,15 +2991,15 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): self._check_empty_sequence(iter("")) def test_constructor_heterogenous_futures(self): - fut1 = asyncio.Future(loop=self.one_loop) - fut2 = asyncio.Future(loop=self.other_loop) + fut1 = self.one_loop.create_future() + fut2 = self.other_loop.create_future() with self.assertRaises(ValueError): asyncio.gather(fut1, fut2) with self.assertRaises(ValueError): asyncio.gather(fut1, loop=self.other_loop) def test_constructor_homogenous_futures(self): - children = [asyncio.Future(loop=self.other_loop) for i in range(3)] + children = [self.other_loop.create_future() for i in range(3)] fut = asyncio.gather(*children) self.assertIs(fut._loop, self.other_loop) self._run_loop(self.other_loop) @@ -3010,7 +3010,7 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): self.assertFalse(fut.done()) def test_one_cancellation(self): - a, b, c, d, e = [asyncio.Future(loop=self.one_loop) for i in range(5)] + a, b, c, d, e = [self.one_loop.create_future() for i in range(5)] fut = asyncio.gather(a, b, c, d, e) cb = test_utils.MockCallback() fut.add_done_callback(cb) @@ -3028,7 +3028,7 @@ class FutureGatherTests(GatherTestsBase, test_utils.TestCase): e.exception() def test_result_exception_one_cancellation(self): - a, b, c, d, e, f = [asyncio.Future(loop=self.one_loop) + a, b, c, d, e, f = [self.one_loop.create_future() for i in range(6)] fut = asyncio.gather(a, b, c, d, e, f, return_exceptions=True) cb = test_utils.MockCallback() @@ -3094,7 +3094,7 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase): def test_cancellation_broadcast(self): # Cancelling outer() cancels all children. proof = 0 - waiter = asyncio.Future(loop=self.one_loop) + waiter = self.one_loop.create_future() async def inner(): nonlocal proof @@ -3130,8 +3130,8 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase): await f raise RuntimeError('should not be ignored') - a = asyncio.Future(loop=self.one_loop) - b = asyncio.Future(loop=self.one_loop) + a = self.one_loop.create_future() + b = self.one_loop.create_future() async def outer(): await asyncio.gather(inner(a), inner(b), loop=self.one_loop) |