summaryrefslogtreecommitdiff
path: root/tests/functional/y/yield_inside_async_function.py
blob: 9f293b47d323f037b04ac0e1001add83a2d54466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Test that `yield` or `yield from` can't be used inside an async function."""
# pylint: disable=missing-docstring, unused-variable

async def good():
    def _inner():
        yield 42
        yield from [1, 2, 3]

async def good_two():
    # Starting from python 3.6 it's possible to yield inside async
    # https://www.python.org/dev/peps/pep-0525/
    yield 42


async def bad():
    yield from [1, 2, 3] # [yield-inside-async-function]