Removed ServiceProviderABC #186
This commit is contained in:
@@ -2,7 +2,7 @@ import unittest
|
||||
|
||||
from cpl.application import ApplicationABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.dependency import ServiceProviderABC
|
||||
from cpl.dependency import ServiceProvider
|
||||
from unittests_cli.cli_test_suite import CLITestSuite
|
||||
from unittests_core.core_test_suite import CoreTestSuite
|
||||
from unittests_query.query_test_suite import QueryTestSuite
|
||||
@@ -10,7 +10,7 @@ from unittests_translation.translation_test_suite import TranslationTestSuite
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProvider):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
def configure(self): ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.dependency import ServiceCollection, ServiceLifetimeEnum, ServiceProviderABC
|
||||
from cpl.dependency import ServiceCollection, ServiceLifetimeEnum, ServiceProvider
|
||||
|
||||
|
||||
class ServiceCollectionTestCase(unittest.TestCase):
|
||||
@@ -51,6 +51,6 @@ class ServiceCollectionTestCase(unittest.TestCase):
|
||||
service = self._sc._service_descriptors[0]
|
||||
self.assertIsNone(service.implementation)
|
||||
sp = self._sc.build()
|
||||
self.assertTrue(isinstance(sp, ServiceProviderABC))
|
||||
self.assertTrue(isinstance(sp, ServiceProvider))
|
||||
self.assertTrue(isinstance(sp.get_service(Mock), Mock))
|
||||
self.assertIsNotNone(service.implementation)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.dependency import ServiceCollection, ServiceProviderABC
|
||||
from cpl.dependency import ServiceCollection, ServiceProvider
|
||||
|
||||
|
||||
class ServiceCount:
|
||||
@@ -10,21 +10,21 @@ class ServiceCount:
|
||||
|
||||
|
||||
class TestService:
|
||||
def __init__(self, sp: ServiceProviderABC, count: ServiceCount):
|
||||
def __init__(self, sp: ServiceProvider, count: ServiceCount):
|
||||
count.count += 1
|
||||
self.sp = sp
|
||||
self.id = count.count
|
||||
|
||||
|
||||
class DifferentService:
|
||||
def __init__(self, sp: ServiceProviderABC, count: ServiceCount):
|
||||
def __init__(self, sp: ServiceProvider, count: ServiceCount):
|
||||
count.count += 1
|
||||
self.sp = sp
|
||||
self.id = count.count
|
||||
|
||||
|
||||
class MoreDifferentService:
|
||||
def __init__(self, sp: ServiceProviderABC, count: ServiceCount):
|
||||
def __init__(self, sp: ServiceProvider, count: ServiceCount):
|
||||
count.count += 1
|
||||
self.sp = sp
|
||||
self.id = count.count
|
||||
@@ -72,7 +72,7 @@ class ServiceProviderTestCase(unittest.TestCase):
|
||||
singleton = self._services.get_service(TestService)
|
||||
transient = self._services.get_service(DifferentService)
|
||||
with self._services.create_scope() as scope:
|
||||
sp: ServiceProviderABC = scope.service_provider
|
||||
sp: ServiceProvider = scope.service_provider
|
||||
self.assertNotEqual(sp, self._services)
|
||||
y = sp.get_service(DifferentService)
|
||||
self.assertIsNotNone(y)
|
||||
|
||||
Reference in New Issue
Block a user