Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert @asyncio.coroutine to async def #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions tests/test_awaitable.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)