mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
PEP 0492 -- Coroutines with async and await syntax. Issue #24017.
This commit is contained in:
parent
4e6bf4b3da
commit
7544508f02
72 changed files with 9261 additions and 5739 deletions
|
|
@ -63,6 +63,22 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
|||
" if (yield):\n"
|
||||
" yield x\n")
|
||||
|
||||
def test_await_statement(self):
|
||||
self.check_suite("async def f():\n await smth()")
|
||||
self.check_suite("async def f():\n foo = await smth()")
|
||||
self.check_suite("async def f():\n foo, bar = await smth()")
|
||||
self.check_suite("async def f():\n (await smth())")
|
||||
self.check_suite("async def f():\n foo((await smth()))")
|
||||
self.check_suite("async def f():\n await foo(); return 42")
|
||||
|
||||
def test_async_with_statement(self):
|
||||
self.check_suite("async def f():\n async with 1: pass")
|
||||
self.check_suite("async def f():\n async with a as b, c as d: pass")
|
||||
|
||||
def test_async_for_statement(self):
|
||||
self.check_suite("async def f():\n async for i in (): pass")
|
||||
self.check_suite("async def f():\n async for i, b in (): pass")
|
||||
|
||||
def test_nonlocal_statement(self):
|
||||
self.check_suite("def f():\n"
|
||||
" x = 0\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue