mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__.
Patch by iceboy.
This commit is contained in:
parent
5587d7c071
commit
45dccdad93
4 changed files with 26 additions and 15 deletions
|
|
@ -2224,7 +2224,7 @@ else:
|
|||
return asyncio.SelectorEventLoop(selectors.SelectSelector())
|
||||
|
||||
|
||||
def noop(*args):
|
||||
def noop(*args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
|
|
@ -2305,6 +2305,13 @@ class HandleTests(test_utils.TestCase):
|
|||
% (re.escape(filename), lineno))
|
||||
self.assertRegex(repr(h), regex)
|
||||
|
||||
# partial function with keyword args
|
||||
cb = functools.partial(noop, x=1)
|
||||
h = asyncio.Handle(cb, (2, 3), self.loop)
|
||||
regex = (r'^<Handle noop\(x=1\)\(2, 3\) at %s:%s>$'
|
||||
% (re.escape(filename), lineno))
|
||||
self.assertRegex(repr(h), regex)
|
||||
|
||||
# partial method
|
||||
if sys.version_info >= (3, 4):
|
||||
method = HandleTests.test_handle_repr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue