mirror of https://github.com/cool-RR/PySnooper.git
Make tests nicer
This commit is contained in:
parent
53bc524b7e
commit
1ef8beb90b
|
@ -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)
|
Loading…
Reference in New Issue