python-dependency-injector/tests/unit/wiring/test_introspection_py36.py

30 lines
533 B
Python
Raw Normal View History

"""Tests for compatibility of @inject-patched functions with asyncio and inspect module checks."""
import asyncio
import inspect
from dependency_injector.wiring import inject
def test_isfunction():
@inject
def foo(): ...
assert inspect.isfunction(foo)
def test_asyncio_iscoroutinefunction():
@inject
async def foo():
...
assert asyncio.iscoroutinefunction(foo)
def test_inspect_iscoroutinefunction():
@inject
async def foo():
...
assert inspect.iscoroutinefunction(foo)