Make tests even nicer

This commit is contained in:
Ram Rachum 2019-09-14 10:17:26 +03:00
parent 1ef8beb90b
commit 85c929285e

View file

@ -29,7 +29,9 @@ def test_rejecting_coroutine_functions():
async def foo(x):
return 'lol'
''')
exec(code, globals())
namespace = {}
exec(code, namespace)
foo = namespace['foo']
assert pycompat.iscoroutinefunction(foo)
assert not pycompat.isasyncgenfunction(foo)
@ -45,7 +47,9 @@ def test_rejecting_async_generator_functions():
async def foo(x):
yield 'lol'
''')
exec(code, globals())
namespace = {}
exec(code, namespace)
foo = namespace['foo']
assert not pycompat.iscoroutinefunction(foo)
assert pycompat.isasyncgenfunction(foo)