From c0131549b0a09e019821044a0e31b224a4c70816 Mon Sep 17 00:00:00 2001 From: jazzthief Date: Wed, 24 May 2023 15:46:06 +0200 Subject: [PATCH] Use `Singleton` provider; clean up formatting --- tests/unit/samples/wiringstringids/resourceclosing.py | 10 +++++++--- tests/unit/wiring/string_ids/test_main_py36.py | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/unit/samples/wiringstringids/resourceclosing.py b/tests/unit/samples/wiringstringids/resourceclosing.py index 6d9888ee..b692c488 100644 --- a/tests/unit/samples/wiringstringids/resourceclosing.py +++ b/tests/unit/samples/wiringstringids/resourceclosing.py @@ -64,7 +64,7 @@ class Container(containers.DeclarativeContainer): class ContainerSingleton(containers.DeclarativeContainer): - singleton = providers.Resource(Singleton) + singleton = providers.Singleton(Singleton) service = providers.Resource( init_service_with_singleton, singleton @@ -83,12 +83,16 @@ def test_function(service: Service = Closing[Provide["service"]]): @inject -def test_function_dependency(factory: FactoryService = Closing[Provide["factory_service"]]): +def test_function_dependency( + factory: FactoryService = Closing[Provide["factory_service"]] +): return factory @inject -def test_function_dependency_kwargs(factory: FactoryService = Closing[Provide["factory_service_kwargs"]]): +def test_function_dependency_kwargs( + factory: FactoryService = Closing[Provide["factory_service_kwargs"]] +): return factory diff --git a/tests/unit/wiring/string_ids/test_main_py36.py b/tests/unit/wiring/string_ids/test_main_py36.py index aed9364d..2861c3aa 100644 --- a/tests/unit/wiring/string_ids/test_main_py36.py +++ b/tests/unit/wiring/string_ids/test_main_py36.py @@ -33,7 +33,10 @@ def subcontainer(): container.unwire() -@fixture(params=[resourceclosing.Container, resourceclosing.ContainerSingleton]) +@fixture(params=[ + resourceclosing.Container, + resourceclosing.ContainerSingleton, +]) def resourceclosing_container(request): container = request.param() container.wire(modules=[resourceclosing])