asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandle

- Uniformize repr() output to format "<Class ...>"
- On Python 3.5+, repr(Task) uses the qualified name instead of the short name
  of the coroutine
This commit is contained in:
Victor Stinner 2014-06-25 21:41:58 +02:00
parent 65c623de74
commit 975735f729
7 changed files with 232 additions and 129 deletions

View file

@ -1016,14 +1016,14 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self.loop.run_forever()
fmt, *args = m_logger.warning.call_args[0]
self.assertRegex(fmt % tuple(args),
"^Executing Handle.*stop_loop_cb.* took .* seconds$")
"^Executing <Handle.*stop_loop_cb.*> took .* seconds$")
# slow task
asyncio.async(stop_loop_coro(self.loop), loop=self.loop)
self.loop.run_forever()
fmt, *args = m_logger.warning.call_args[0]
self.assertRegex(fmt % tuple(args),
"^Executing Task.*stop_loop_coro.* took .* seconds$")
"^Executing <Task.*stop_loop_coro.*> took .* seconds$")
if __name__ == '__main__':