Skip to content

Instantly share code, notes, and snippets.

@malinoff
Last active December 11, 2016 07:16
Show Gist options
  • Save malinoff/148507bf51ff8b9a0a947c178aa0ac3a to your computer and use it in GitHub Desktop.
Save malinoff/148507bf51ff8b9a0a947c178aa0ac3a to your computer and use it in GitHub Desktop.
import asyncio
from _pytest.compat import is_generator
async def foo():
await foo()
async def bar():
pass
print(is_generator(foo))
from _pytest._code import getrawcode
print(is_generator(foo))
print(is_generator(bar))
@asyncio.coroutine
def baz():
yield from bar()
def zap():
yield
print(is_generator(baz))
print(is_generator(zap))
$ python example.com
False
32
0
32
32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment