summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-08 21:57:31 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-08 21:57:31 (GMT)
commitbfff45d611f3435ed4b713124f65fba8e961ff03 (patch)
tree752da659a58b6ac8178ff41a9d890cd83f2e7177 /Lib/test/test_asyncio/test_events.py
parentaea82293be0a56937fe807a0d2a44c7db392f155 (diff)
downloadcpython-bfff45d611f3435ed4b713124f65fba8e961ff03.zip
cpython-bfff45d611f3435ed4b713124f65fba8e961ff03.tar.gz
cpython-bfff45d611f3435ed4b713124f65fba8e961ff03.tar.bz2
asyncion, Tulip issue 181: BaseEventLoop.create_datagram_endpoint() now waits
until protocol.connection_made() has been called. Document also why transport constructors use a waiter.
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r--Lib/test/test_asyncio/test_events.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index b89416f..e5c5729 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -522,6 +522,7 @@ class EventLoopTestsMixin:
tr, pr = self.loop.run_until_complete(connection_fut)
self.assertIsInstance(tr, asyncio.Transport)
self.assertIsInstance(pr, asyncio.Protocol)
+ self.assertIs(pr.transport, tr)
if check_sockname:
self.assertIsNotNone(tr.get_extra_info('sockname'))
self.loop.run_until_complete(pr.done)
@@ -1045,12 +1046,21 @@ class EventLoopTestsMixin:
s_transport, server = self.loop.run_until_complete(coro)
host, port = s_transport.get_extra_info('sockname')
+ self.assertIsInstance(s_transport, asyncio.Transport)
+ self.assertIsInstance(server, TestMyDatagramProto)
+ self.assertEqual('INITIALIZED', server.state)
+ self.assertIs(server.transport, s_transport)
+
coro = self.loop.create_datagram_endpoint(
lambda: MyDatagramProto(loop=self.loop),
remote_addr=(host, port))
transport, client = self.loop.run_until_complete(coro)
+ self.assertIsInstance(transport, asyncio.Transport)
+ self.assertIsInstance(client, MyDatagramProto)
self.assertEqual('INITIALIZED', client.state)
+ self.assertIs(client.transport, transport)
+
transport.sendto(b'xxx')
test_utils.run_until(self.loop, lambda: server.nbytes)
self.assertEqual(3, server.nbytes)