mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +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
|
@ -55,12 +55,42 @@ class TestMatrixMultiplication(GrammarTest):
|
|||
|
||||
|
||||
class TestYieldFrom(GrammarTest):
|
||||
def test_matrix_multiplication_operator(self):
|
||||
def test_yield_from(self):
|
||||
self.validate("yield from x")
|
||||
self.validate("(yield from x) + y")
|
||||
self.invalid_syntax("yield from")
|
||||
|
||||
|
||||
class TestAsyncAwait(GrammarTest):
|
||||
def test_await_expr(self):
|
||||
self.validate("""async def foo():
|
||||
await x
|
||||
""")
|
||||
|
||||
self.invalid_syntax("await x")
|
||||
self.invalid_syntax("""def foo():
|
||||
await x""")
|
||||
|
||||
def test_async_var(self):
|
||||
self.validate("""async = 1""")
|
||||
self.validate("""await = 1""")
|
||||
self.validate("""def async(): pass""")
|
||||
|
||||
def test_async_with(self):
|
||||
self.validate("""async def foo():
|
||||
async for a in b: pass""")
|
||||
|
||||
self.invalid_syntax("""def foo():
|
||||
async for a in b: pass""")
|
||||
|
||||
def test_async_for(self):
|
||||
self.validate("""async def foo():
|
||||
async with a: pass""")
|
||||
|
||||
self.invalid_syntax("""def foo():
|
||||
async with a: pass""")
|
||||
|
||||
|
||||
class TestRaiseChanges(GrammarTest):
|
||||
def test_2x_style_1(self):
|
||||
self.validate("raise")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue