summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_parser.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-12 02:57:16 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-12 02:57:16 (GMT)
commit7544508f0245173bff5866aa1598c8f6cce1fc5f (patch)
treebf80850d9cd46fc811f04b8c2484fb50775c697d /Lib/test/test_parser.py
parent4e6bf4b3da03b132b0698f30ee931a350585b117 (diff)
downloadcpython-7544508f0245173bff5866aa1598c8f6cce1fc5f.zip
cpython-7544508f0245173bff5866aa1598c8f6cce1fc5f.tar.gz
cpython-7544508f0245173bff5866aa1598c8f6cce1fc5f.tar.bz2
PEP 0492 -- Coroutines with async and await syntax. Issue #24017.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r--Lib/test/test_parser.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index 56b5d95..7082273 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"