mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-19 12:32:27 +03:00
Add test
This commit is contained in:
parent
fa81cadf29
commit
ee809a44e6
|
@ -0,0 +1,8 @@
|
||||||
|
from dependency_injector.wiring import Provide
|
||||||
|
|
||||||
|
from ..container import Container
|
||||||
|
from ..service import Service
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_function(service: Service = Provide[Container.service]):
|
||||||
|
return service
|
|
@ -21,6 +21,11 @@ class WiringTest(unittest.TestCase):
|
||||||
self.addCleanup(self.container.unwire)
|
self.addCleanup(self.container.unwire)
|
||||||
|
|
||||||
def test_package_lookup(self):
|
def test_package_lookup(self):
|
||||||
|
from .package import test_package_function
|
||||||
|
service = test_package_function()
|
||||||
|
self.assertIsInstance(service, Service)
|
||||||
|
|
||||||
|
def test_package_submodule_lookup(self):
|
||||||
from .package.subpackage.submodule import test_function
|
from .package.subpackage.submodule import test_function
|
||||||
service = test_function()
|
service = test_function()
|
||||||
self.assertIsInstance(service, Service)
|
self.assertIsInstance(service, Service)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user