mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Merge branch 'release/3.23.1' into master
This commit is contained in:
commit
4a1caf7300
|
@ -7,6 +7,13 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
3.23.1
|
||||
------
|
||||
- Fix an issue with creating ``Dependency`` provider with ``abc.ABCMeta``.
|
||||
Thanks to `awaizman1 <https://github.com/awaizman1>`_. More info:
|
||||
`Issue #266 <https://github.com/ets-labs/python-dependency-injector/issues/266>`_,
|
||||
`PR #267 <https://github.com/ets-labs/python-dependency-injector/pull/267>`_.
|
||||
|
||||
3.23.0
|
||||
------
|
||||
- Add ``Flask`` tutorial.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Dependency injector top-level package."""
|
||||
|
||||
__version__ = '3.23.0'
|
||||
__version__ = '3.23.1'
|
||||
"""Version number that follows semantic versioning.
|
||||
|
||||
:type: str
|
||||
|
|
|
@ -915,12 +915,12 @@ struct __pyx_obj_19dependency_injector_9providers_Delegate {
|
|||
*
|
||||
*
|
||||
* cdef class Dependency(Provider): # <<<<<<<<<<<<<<
|
||||
* cdef type __instance_of
|
||||
* cdef object __instance_of
|
||||
*
|
||||
*/
|
||||
struct __pyx_obj_19dependency_injector_9providers_Dependency {
|
||||
struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base;
|
||||
PyTypeObject *__pyx___instance_of;
|
||||
PyObject *__pyx___instance_of;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ static struct __pyx_vtabstruct_19dependency_injector_9providers_Delegate *__pyx_
|
|||
*
|
||||
*
|
||||
* cdef class Dependency(Provider): # <<<<<<<<<<<<<<
|
||||
* cdef type __instance_of
|
||||
* cdef object __instance_of
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ cdef class Delegate(Provider):
|
|||
|
||||
|
||||
cdef class Dependency(Provider):
|
||||
cdef type __instance_of
|
||||
cdef object __instance_of
|
||||
|
||||
|
||||
cdef class ExternalDependency(Dependency):
|
||||
|
|
|
@ -419,8 +419,16 @@ cdef class Dependency(Provider):
|
|||
:type: type
|
||||
"""
|
||||
|
||||
def __init__(self, type instance_of=object):
|
||||
def __init__(self, object instance_of=object):
|
||||
"""Initializer."""
|
||||
if not isinstance(instance_of, CLASS_TYPES):
|
||||
raise TypeError(
|
||||
'Argument \'instance_of\' has incorrect type (expected {0}, got {1}))'.format(
|
||||
CLASS_TYPES,
|
||||
instance_of,
|
||||
)
|
||||
)
|
||||
|
||||
self.__instance_of = instance_of
|
||||
super(Dependency, self).__init__()
|
||||
|
||||
|
|
|
@ -249,6 +249,18 @@ class DependencyTests(unittest.TestCase):
|
|||
def test_init_with_not_class(self):
|
||||
self.assertRaises(TypeError, providers.Dependency, object())
|
||||
|
||||
def test_with_abc(self):
|
||||
try:
|
||||
import collections.abc as collections_abc
|
||||
except ImportError:
|
||||
import collections as collections_abc
|
||||
|
||||
provider = providers.Dependency(collections_abc.Mapping)
|
||||
provider.provided_by(providers.Factory(dict))
|
||||
|
||||
self.assertIsInstance(provider(), collections_abc.Mapping)
|
||||
self.assertIsInstance(provider(), dict)
|
||||
|
||||
def test_is_provider(self):
|
||||
self.assertTrue(providers.is_provider(self.provider))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user