mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
[3.12] gh-121025: Improve partialmethod.__repr__ (GH-121033) (GH-121038)
It no longer contains redundant commas and spaces.
(cherry picked from commit d2646e3f45
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
5290e405c1
commit
41e1ac6a23
4 changed files with 18 additions and 10 deletions
|
@ -564,6 +564,14 @@ class TestPartialMethod(unittest.TestCase):
|
|||
method = functools.partialmethod(func=capture, a=1)
|
||||
|
||||
def test_repr(self):
|
||||
self.assertEqual(repr(vars(self.A)['nothing']),
|
||||
'functools.partialmethod({})'.format(capture))
|
||||
self.assertEqual(repr(vars(self.A)['positional']),
|
||||
'functools.partialmethod({}, 1)'.format(capture))
|
||||
self.assertEqual(repr(vars(self.A)['keywords']),
|
||||
'functools.partialmethod({}, a=2)'.format(capture))
|
||||
self.assertEqual(repr(vars(self.A)['spec_keywords']),
|
||||
'functools.partialmethod({}, self=1, func=2)'.format(capture))
|
||||
self.assertEqual(repr(vars(self.A)['both']),
|
||||
'functools.partialmethod({}, 3, b=4)'.format(capture))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue