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.
|
||||
It's a consistency change to make ``Singleton`` match ``Callable``
|
||||
and ``Factory`` interfaces.
|
||||
- Update string representation of ``Resource`` provider.
|
||||
|
||||
4.13.2
|
||||
------
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2992,11 +2992,12 @@ cdef class Resource(Provider):
|
|||
|
||||
return copied
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f'{self.__class__.__name__}({self.__initializer}, '
|
||||
f'initialized={self.__initialized})'
|
||||
)
|
||||
def __str__(self):
|
||||
"""Return string representation of provider.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return represent_provider(provider=self, provides=self.__initializer)
|
||||
|
||||
@property
|
||||
def args(self):
|
||||
|
|
|
@ -337,9 +337,9 @@ class ResourceTests(unittest.TestCase):
|
|||
|
||||
self.assertEqual(
|
||||
repr(provider),
|
||||
'Resource({0}, initialized={1})'.format(
|
||||
init_fn,
|
||||
provider.initialized,
|
||||
'<dependency_injector.providers.Resource({0}) at {1}>'.format(
|
||||
repr(init_fn),
|
||||
hex(id(provider)),
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user