diff --git a/tests/integration/test_fastapi/handlers.py b/tests/integration/test_fastapi/handlers.py index de7510e..b2558d9 100644 --- a/tests/integration/test_fastapi/handlers.py +++ b/tests/integration/test_fastapi/handlers.py @@ -13,6 +13,7 @@ router = APIRouter(prefix="/api") RedisDependency = Annotated[Redis, Depends(Provide[Container.redis])] +RedisDependencyWithOnlyProvider = Annotated[Redis, Depends(Container.redis)] @router.get("/values") diff --git a/tests/test_base_container.py b/tests/test_base_container.py index d022e7c..6911b3a 100644 --- a/tests/test_base_container.py +++ b/tests/test_base_container.py @@ -10,15 +10,12 @@ def test_get_providers(container): providers = container.get_providers() + assert len(providers) > 0 + for provider in providers: assert isinstance(provider, BaseProvider) -def test_get_provider_by_attr_name_fail_on_not_exists_provider(container): - with pytest.raises(Exception): - container.get_provider_by_attr_name("not_exists_provider") - - def test_override_providers_fail_with_unknown_provider(container): unknown_provider = "not_exists_provider" match = f"Provider with name {unknown_provider!r} not found" @@ -72,7 +69,7 @@ def test_reset_singletons(container): for provider in providers: if isinstance(provider, Singleton): - _ = provider() + provider() assert provider._instance is not None container.reset_singletons()