mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-04 12:23:14 +03:00
Update resource provider string representation
This commit is contained in:
parent
b02c70e764
commit
7a2c61e9f8
|
@ -12,6 +12,7 @@ Development version
|
||||||
- Add ``.provides`` attribute to ``Singleton`` and its subclasses.
|
- Add ``.provides`` attribute to ``Singleton`` and its subclasses.
|
||||||
It's a consistency change to make ``Singleton`` match ``Callable``
|
It's a consistency change to make ``Singleton`` match ``Callable``
|
||||||
and ``Factory`` interfaces.
|
and ``Factory`` interfaces.
|
||||||
|
- Update string representation of ``Resource`` provider.
|
||||||
|
|
||||||
4.13.2
|
4.13.2
|
||||||
------
|
------
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2992,11 +2992,12 @@ cdef class Resource(Provider):
|
||||||
|
|
||||||
return copied
|
return copied
|
||||||
|
|
||||||
def __repr__(self):
|
def __str__(self):
|
||||||
return (
|
"""Return string representation of provider.
|
||||||
f'{self.__class__.__name__}({self.__initializer}, '
|
|
||||||
f'initialized={self.__initialized})'
|
:rtype: str
|
||||||
)
|
"""
|
||||||
|
return represent_provider(provider=self, provides=self.__initializer)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def args(self):
|
def args(self):
|
||||||
|
|
|
@ -337,9 +337,9 @@ class ResourceTests(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
repr(provider),
|
repr(provider),
|
||||||
'Resource({0}, initialized={1})'.format(
|
'<dependency_injector.providers.Resource({0}) at {1}>'.format(
|
||||||
init_fn,
|
repr(init_fn),
|
||||||
provider.initialized,
|
hex(id(provider)),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user