Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
80 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from tests import has_async_await | ||
|
||
def _run_async(coroutine): | ||
import asyncio | ||
loop = asyncio.get_event_loop() | ||
f = asyncio.ensure_future(coroutine, loop=loop) | ||
return loop.run_until_complete(f) | ||
|
||
|
||
@has_async_await | ||
def test_future_supports_await_syntax(future): | ||
async def _get_value(): | ||
return await future | ||
future.set(1) | ||
assert _run_async(_get_value()) == 1 | ||
|
||
|
||
def test_future_supports_yield_from_syntax(future): | ||
def _get_value(): | ||
val = yield from future | ||
return val | ||
future.set(1) | ||
assert _run_async(_get_value()) == 1 |