From 3cde549d30b38dcff81b308e18c7f61783003791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Sat, 18 Jun 2022 19:01:09 +0200 Subject: [PATCH] Convert @asyncio.coroutine to async def --- 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 resolve_or_reject(resolve, reject): @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)