def test_load_service_by_str(self):
     self.assertIsInstance(
         utils.load_service(Service.__module__ + '.Service'), Service_test)
 def test_load_service_by_class(self):
     self.assertIsInstance(utils.load_service(Service), Service_test)
    def test_load_service_unregistered(self):
        with self.assertRaises(KeyError), self.assertLogs(
                utils.__name__) as log:
            utils.load_service(__name__)

        self.assertIn(f'{__name__} is not registered', str(log.output))
 def test_load_service_by_instance(self):
     service = Service()
     self.assertIs(utils.load_service(service), service)
 def test_load_service_by_str_using_default_implementation(self):
     self.assertIsInstance(
         utils.load_service(Service.__module__ + '.Service2'), Service)