def test_compiler_yield_return(self):
        ret = self.c.compile_function_def(
            self._make_expression(HySymbol("fn"),
                                  HyList(),
                                  HyExpression([HySymbol("yield"),
                                                HyInteger(2)]),
                                  HyExpression([HySymbol("+"),
                                                HyInteger(1),
                                                HyInteger(1)])))

        self.assertEqual(len(ret.stmts), 1)
        stmt = ret.stmts[0]
        self.assertIsInstance(stmt, ast.FunctionDef)
        body = stmt.body
        self.assertEquals(len(body), 2)
        self.assertIsInstance(body[0], ast.Expr)
        self.assertIsInstance(body[0].value, ast.Yield)

        if PY33:
            # From 3.3+, the final statement becomes a return value
            self.assertIsInstance(body[1], ast.Return)
            self.assertIsInstance(body[1].value, ast.BinOp)
        else:
            # In earlier versions, the expression is not returned
            self.assertIsInstance(body[1], ast.Expr)
            self.assertIsInstance(body[1].value, ast.BinOp)
Check that the compiler correctly generates return statements for
dataset/ETHPy150Open hylang/hy/tests/compilers/test_compiler.py/HyASTCompilerTest.test_compiler_yield_return