@@ -559,7 +559,7 @@ def injected(repo: DocumentRepository = Provide[_Container._factory_provider]) -
559559
560560def test_simple_injection_into_iterator_sync () -> None :
561561 class _Container (BaseContainer ):
562- sync_resource = providers .Factory (lambda : random .random () )
562+ sync_resource = providers .Factory (random .random )
563563
564564 @contextmanager
565565 @inject
@@ -592,7 +592,7 @@ def test_simple_injection_into_generator_sync() -> None:
592592 _max_multiplier = 3
593593
594594 class _Container (BaseContainer ):
595- sync_resource = providers .Factory (lambda : random .random () )
595+ sync_resource = providers .Factory (random .random )
596596
597597 @inject
598598 def _injected (val : float = Provide ["_Container.sync_resource" ]) -> typing .Generator [float , None , None ]:
@@ -659,7 +659,7 @@ async def _injected(val: float = Provide[_Container.sync_resource]) -> typing.As
659659
660660def test_simple_override_injection_into_iterator_sync () -> None :
661661 class _Container (BaseContainer ):
662- sync_resource = providers .Factory (lambda : random .random () )
662+ sync_resource = providers .Factory (random .random )
663663
664664 @contextmanager
665665 @inject
@@ -692,7 +692,7 @@ async def _injected(val: float = Provide[_Container.async_resource]) -> typing.A
692692
693693def test_simple_injection_into_generator_with_receive_sync () -> None :
694694 class _Container (BaseContainer ):
695- sync_resource = providers .Factory (lambda : random .random () )
695+ sync_resource = providers .Factory (random .random )
696696
697697 value_to_send = 5
698698
@@ -717,7 +717,7 @@ def _injected_receive(initial_val: float = Provide[_Container.sync_resource]) ->
717717
718718def test_simple_injection_into_generator_with_return_sync () -> None :
719719 class _Container (BaseContainer ):
720- sync_resource = providers .Factory (lambda : random .random () )
720+ sync_resource = providers .Factory (random .random )
721721
722722 multiplier = 4
723723
@@ -746,7 +746,7 @@ def _injected_return(
746746
747747def test_simple_injection_into_generator_yield_once_receive_return_sync () -> None : # Renamed test slightly
748748 class _Container (BaseContainer ):
749- sync_resource = providers .Factory (lambda : random .random () )
749+ sync_resource = providers .Factory (random .random )
750750
751751 send_value = 7
752752 return_add = 100
@@ -849,7 +849,7 @@ async def _injected(val: float = Provide[_Container.sync_resource]) -> typing.As
849849
850850def test_injection_by_type_sync () -> None :
851851 class _Container (BaseContainer ):
852- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
852+ sync_resource = providers .Factory (random .random ).bind (float )
853853
854854 @inject (container = _Container )
855855 def _injected_1 (val : float = Provide ()) -> float :
@@ -865,7 +865,7 @@ def _injected_2(val: float = Provide()) -> float:
865865
866866async def test_injection_by_type_async () -> None :
867867 class _Container (BaseContainer ):
868- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
868+ sync_resource = providers .Factory (random .random ).bind (float )
869869
870870 @inject (container = _Container )
871871 async def _injected_1 (val : float = Provide ()) -> float :
@@ -881,7 +881,7 @@ async def _injected_2(val: float = Provide()) -> float:
881881
882882async def test_injection_by_type_async_generator () -> None :
883883 class _Container (BaseContainer ):
884- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
884+ sync_resource = providers .Factory (random .random ).bind (float )
885885
886886 @inject (container = _Container )
887887 async def _injected_1 (val : float = Provide ()) -> typing .AsyncGenerator [float , None ]:
@@ -897,7 +897,7 @@ async def _injected_2(val: float = Provide()) -> typing.AsyncGenerator[float, No
897897
898898def test_injection_by_type_sync_generator () -> None :
899899 class _Container (BaseContainer ):
900- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
900+ sync_resource = providers .Factory (random .random ).bind (float )
901901
902902 @inject (container = _Container )
903903 def _injected_1 (val : float = Provide ()) -> typing .Generator [float , None , None ]:
@@ -945,7 +945,7 @@ async def _injected_2(val: float = Provide()) -> typing.AsyncGenerator[float, No
945945
946946def test_inject_by_type_fails_if_type_is_not_bound_sync () -> None :
947947 class _Container (BaseContainer ):
948- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
948+ sync_resource = providers .Factory (random .random ).bind (float )
949949
950950 @_Container .inject
951951 def _injected_1 (val : int = Provide ()) -> float :
@@ -964,7 +964,7 @@ def _injected_2(val: int = Provide()) -> typing.Generator[float, None, None]:
964964
965965async def test_inject_by_type_fails_if_type_is_not_bound_async () -> None :
966966 class _Container (BaseContainer ):
967- sync_resource = providers .Factory (lambda : random .random () ).bind (float )
967+ sync_resource = providers .Factory (random .random ).bind (float )
968968
969969 @_Container .inject
970970 async def _injected_1 (val : int = Provide ()) -> float :
@@ -986,7 +986,7 @@ class A: ...
986986 class B (A ): ...
987987
988988 class _Container (BaseContainer ):
989- sync_resource = providers .Factory (lambda : B () ).bind (B , contravariant = True )
989+ sync_resource = providers .Factory (B ).bind (B , contravariant = True )
990990
991991 @inject (container = _Container )
992992 def _injected (val_a : A = Provide (), val_b : B = Provide ()) -> tuple [A , B ]:
@@ -1004,7 +1004,7 @@ class A: ...
10041004 class B (A ): ...
10051005
10061006 class _Container (BaseContainer ):
1007- sync_resource = providers .Factory (lambda : B () ).bind (B , contravariant = True )
1007+ sync_resource = providers .Factory (B ).bind (B , contravariant = True )
10081008
10091009 @inject (container = _Container )
10101010 async def _injected (val_a : A = Provide (), val_b : B = Provide ()) -> tuple [A , B ]:
@@ -1018,7 +1018,7 @@ async def _injected(val_a: A = Provide(), val_b: B = Provide()) -> tuple[A, B]:
10181018
10191019def test_type_injection_fails_without_bind_sync () -> None :
10201020 class _Container (BaseContainer ):
1021- sync_resource = providers .Factory (lambda : random .random () )
1021+ sync_resource = providers .Factory (random .random )
10221022
10231023 @inject (container = _Container )
10241024 def _injected (val : float = Provide ()) -> float :
@@ -1030,7 +1030,7 @@ def _injected(val: float = Provide()) -> float:
10301030
10311031async def test_type_injection_fails_without_bind_async () -> None :
10321032 class _Container (BaseContainer ):
1033- sync_resource = providers .Factory (lambda : random .random () )
1033+ sync_resource = providers .Factory (random .random )
10341034
10351035 @inject (container = _Container )
10361036 async def _injected (val : float = Provide ()) -> float :
0 commit comments