Commit 68ca8552 authored by Denis Bilenko's avatar Denis Bilenko

hub.py: fix doctest in Waiter

parent 282154ec
...@@ -287,7 +287,8 @@ class Waiter(object): ...@@ -287,7 +287,8 @@ class Waiter(object):
The :meth:`get` method must be called from a greenlet other than :class:`Hub`. The :meth:`get` method must be called from a greenlet other than :class:`Hub`.
>>> result = Waiter() >>> result = Waiter()
>>> _ = get_hub().loop.timer(0.1, result.switch, 'hello from Waiter') >>> timer = get_hub().loop.timer(0.1)
>>> timer.start(result.switch, 'hello from Waiter')
>>> result.get() # blocks for 0.1 seconds >>> result.get() # blocks for 0.1 seconds
'hello from Waiter' 'hello from Waiter'
...@@ -295,7 +296,8 @@ class Waiter(object): ...@@ -295,7 +296,8 @@ class Waiter(object):
:class:`Waiter` stores the value. :class:`Waiter` stores the value.
>>> result = Waiter() >>> result = Waiter()
>>> _ = get_hub().loop.timer(0.1, result.switch, 'hi from Waiter') >>> timer = get_hub().loop.timer(0.1)
>>> timer.start(result.switch, 'hi from Waiter')
>>> sleep(0.2) >>> sleep(0.2)
>>> result.get() # returns immediatelly without blocking >>> result.get() # returns immediatelly without blocking
'hi from Waiter' 'hi from Waiter'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment