From b41f8802d343a9c3030aeddf273cf2f2e37544c8 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 27 Oct 2024 21:08:03 +0300 Subject: [PATCH] Remove unused test, add missing assert --- tests/integration/test_fastapi/handlers.py | 1 + tests/test_base_container.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) 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()