From 1ef8beb90b49d134282b5c21708e5c9717745886 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 13 Sep 2019 21:03:45 +0300 Subject: [PATCH] Make tests nicer --- .../{test_async.py => test_not_implemented.py} | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) rename tests/{test_async.py => test_not_implemented.py} (85%) diff --git a/tests/test_async.py b/tests/test_not_implemented.py similarity index 85% rename from tests/test_async.py rename to tests/test_not_implemented.py index 3a7e477..245a184 100644 --- a/tests/test_async.py +++ b/tests/test_not_implemented.py @@ -25,18 +25,11 @@ def test_rejecting_coroutine_functions(): if sys.version_info[:2] <= (3, 4): pytest.skip() - class Thing: - pass - - thing = Thing() - code = textwrap.dedent(''' async def foo(x): return 'lol' - thing.foo = foo ''') - exec(code) - foo = thing.foo + exec(code, globals()) assert pycompat.iscoroutinefunction(foo) assert not pycompat.isasyncgenfunction(foo) @@ -48,18 +41,11 @@ def test_rejecting_async_generator_functions(): if sys.version_info[:2] <= (3, 6): pytest.skip() - class Thing: - pass - - thing = Thing() - code = textwrap.dedent(''' async def foo(x): yield 'lol' - thing.foo = foo ''') - exec(code) - foo = thing.foo + exec(code, globals()) assert not pycompat.iscoroutinefunction(foo) assert pycompat.isasyncgenfunction(foo)