[pypy-commit] pypy py3.5-async: Add unfinished astbuilder tests for async
raffael_t
pypy.commits at gmail.com
Sat Jul 9 10:42:56 EDT 2016
Author: Raffael Tfirst <raffael.tfirst at gmail.com>
Branch: py3.5-async
Changeset: r85627:9eeb13a22e8a
Date: 2016-07-09 16:42 +0200
http://bitbucket.org/pypy/pypy/changeset/9eeb13a22e8a/
Log: Add unfinished astbuilder tests for async
diff --git a/pypy/interpreter/astcompiler/test/test_astbuilder.py b/pypy/interpreter/astcompiler/test/test_astbuilder.py
--- a/pypy/interpreter/astcompiler/test/test_astbuilder.py
+++ b/pypy/interpreter/astcompiler/test/test_astbuilder.py
@@ -1349,3 +1349,33 @@
assert isinstance(expr.left, ast.Name)
assert isinstance(expr.right, ast.Name)
# imatmul is tested earlier search for @=
+
+ def test_asyncFunctionDef(self):
+ mod = self.get_ast("async def f():\n await something()")
+ assert isinstance(mod, ast.Module)
+ body = mod.body
+ assert len(body) == 1
+ expr = body[0].value
+ assert expr.op == ast.MatMul
+ assert isinstance(expr.left, ast.Name)
+ assert isinstance(expr.right, ast.Name)
+
+ def test_asyncAsyncFor(self):
+ mod = self.get_ast("async def f():\n async for e in i: 1\n else: 2")
+ assert isinstance(mod, ast.Module)
+ body = mod.body
+ assert len(body) == 1
+ expr = body[0].value
+ assert expr.op == ast.MatMul
+ assert isinstance(expr.left, ast.Name)
+ assert isinstance(expr.right, ast.Name)
+
+ def test_asyncAsyncWith(self):
+ mod = self.get_ast("async def f():\n async with a as b: 1")
+ assert isinstance(mod, ast.Module)
+ body = mod.body
+ assert len(body) == 1
+ expr = body[0].value
+ assert expr.op == ast.MatMul
+ assert isinstance(expr.left, ast.Name)
+ assert isinstance(expr.right, ast.Name)
More information about the pypy-commit
mailing list