def register_services(services=None): """ Register the services in dependency_injection.Inject. If services is None the Services class is used. """ assert services is dict or services is None if not services: services = Services.__dict__ Inject.register_features(**services)
def test_reset(self): Inject.register_features(Kanga=1, Tiggers=2) class Test(object): kanga = Inject("Kanga") tiggers = Inject("Tiggers") test = Test() self.assertTrue(test.kanga) self.assertTrue(test.tiggers) Inject.reset() with self.assertRaises(KeyError): test.kanga with self.assertRaises(KeyError): test.tiggers