1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
From: =?utf-8?b?VG9tw6HFoSBIcm7EjWlhcg==?= <thrnciar@redhat.com>
Date: Sat, 18 Jun 2022 19:01:09 +0200
Subject: Convert @asyncio.coroutine to async def
Forwarded: https://github.com/syrusakbary/promise/pull/99
---
tests/test_awaitable.py | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/tests/test_awaitable.py b/tests/test_awaitable.py
index aad7f2c..a14a181 100644
--- a/tests/test_awaitable.py
+++ b/tests/test_awaitable.py
@@ -1,18 +1,15 @@
-from asyncio import coroutine
from pytest import mark
from time import sleep
from promise import Promise
@mark.asyncio
-@coroutine
-def test_await():
- yield from Promise.resolve(True)
+async def test_await():
+ await Promise.resolve(True)
@mark.asyncio
-@coroutine
-def test_await_time():
+async def test_await_time():
def resolve_or_reject(resolve, reject):
sleep(.1)
resolve(True)
@@ -22,11 +19,9 @@ def test_await_time():
@mark.asyncio
-@coroutine
-def test_promise_coroutine():
- @coroutine
- def my_coro():
- yield from Promise.resolve(True)
+async def test_promise_coroutine():
+ async def my_coro():
+ await Promise.resolve(True)
promise = Promise.resolve(my_coro())
assert isinstance(promise, Promise)
|