def test_with_class_with_getattr(self): class SomeClass(object): def __getattr__(self, _): return False self.assertFalse(providers.is_provider(SomeClass()))
def test_is_provider(self): self.assertTrue( providers.is_provider(providers.DelegatedFactory(object)))
def test_is_provider(): assert providers.is_provider(providers.Object(object())) is True
def test_is_provider(self): self.assertTrue(providers.is_provider(self.singleton_cls(Example)))
def test_is_provider(self): self.assertTrue(providers.is_provider(providers.Resource(init_fn)))
def test_is_provider(self): self.assertTrue(providers.is_provider(self.delegate))
def test_is_provider(self): self.assertTrue(providers.is_provider(self.factory_aggregate))
def test_is_provider(provider): assert providers.is_provider(provider) is True
def test_is_provider(self): self.assertTrue( providers.is_provider(providers.DelegatedCoroutine(_example)))
def test_is_provider(delegate): assert providers.is_provider(delegate) is True
def test_is_provider(self): self.assertTrue( providers.is_provider(providers.DelegatedCallable(_example)))
def test_is_provider(): assert providers.is_provider(providers.Factory(Example)) is True
def test_is_provider(): assert providers.is_provider(providers.DelegatedFactory(object)) is True
def test_is_provider(): assert providers.is_provider(providers.Self()) is True
def test_is_provider(): assert providers.is_provider(providers.Callable(example)) is True
def test_with_string(): assert providers.is_provider("some_string") is False
def test_is_provider(self): self.assertTrue(providers.is_provider(providers.Object(object())))
def test_with_object(): assert providers.is_provider(object()) is False
def test_is_provider(self): self.assertTrue(providers.is_provider(self.provider))
def test_with_subclass_instance(): class SomeProvider(providers.Provider): pass assert providers.is_provider(SomeProvider()) is True
def test_is_provider(self): self.assertTrue(providers.is_provider(providers.List()))
def test_with_class_with_getattr(): class SomeClass(object): def __getattr__(self, _): return False assert providers.is_provider(SomeClass()) is False
def test_is_provider(): assert providers.is_provider(providers.Resource(init_fn)) is True
def test_with_instance(): assert providers.is_provider(providers.Provider()) is True
def test_is_provider(self): self.assertTrue(providers.is_provider(providers.Factory(Example)))
def test_with_class(): assert providers.is_provider(providers.Provider) is False
def test_is_provider(self): self.assertTrue(providers.is_provider(self.container.service.provided))
def test_is_provider(self): self.assertTrue( providers.is_provider(providers.Selector(self.selector)))
def test_providers_are_providers(self): self.assertTrue(providers.is_provider(self.config.a)) self.assertTrue(providers.is_provider(self.config.a.b)) self.assertTrue(providers.is_provider(self.config.a.b.c)) self.assertTrue(providers.is_provider(self.config.a.b.d))
def test_with_subclass_instance(self): class SomeProvider(providers.Provider): pass self.assertTrue(providers.is_provider(SomeProvider()))