diff options
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r-- | Lib/test/test_parser.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 56b5d950f7a..7082273b8f6 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -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" |