diff --git a/VERSION b/VERSION index 0ea3a944..0c62199f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 +0.2.1 diff --git a/objects/providers.py b/objects/providers.py index 0114090a..2c5ef271 100644 --- a/objects/providers.py +++ b/objects/providers.py @@ -2,6 +2,7 @@ Standard providers. """ +from collections import Iterable from .injections import InitArg, Attribute, Method @@ -119,6 +120,8 @@ class ExternalDependency(Provider): :param instance_of: type """ + if not isinstance(instance_of, Iterable): + instance_of = (instance_of,) self.instance_of = instance_of self.dependency = None super(ExternalDependency, self).__init__() @@ -140,9 +143,9 @@ class ExternalDependency(Provider): result = self.dependency.__call__(*args, **kwargs) - if not isinstance(result, self.instance_of): - raise TypeError('{} is not an instance of {}'.format(result, - self.instance_of)) + if not any((isinstance(result, possible_type) for possible_type in self.instance_of)): + raise TypeError('{} is not an instance of {}'.format(result, self.instance_of)) + return result