summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_sslproto.py
diff options
context:
space:
mode:
authorNikolay Kim <fafhrd91@gmail.com>2017-03-12 12:23:30 -0700
committerYury Selivanov <yselivanov@gmail.com>2017-03-12 15:23:30 -0400
commit2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c (patch)
tree411f91bc286d5ea19c8e380fcd4a3e74bb4e706a /Lib/test/test_asyncio/test_sslproto.py
parent783d0c1a1c723733adcdf4249240246fc35a5bcb (diff)
downloadcpython-git-2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c.tar.gz
bpo-29742: asyncio get_extra_info() throws exception (#525)
Diffstat (limited to 'Lib/test/test_asyncio/test_sslproto.py')
-rw-r--r--Lib/test/test_asyncio/test_sslproto.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 59ff0f6967..f1771c5561 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -95,5 +95,17 @@ class SslProtoHandshakeTests(test_utils.TestCase):
test_utils.run_briefly(self.loop)
self.assertIsInstance(waiter.exception(), ConnectionAbortedError)
+ def test_get_extra_info_on_closed_connection(self):
+ waiter = asyncio.Future(loop=self.loop)
+ ssl_proto = self.ssl_protocol(waiter)
+ self.assertIsNone(ssl_proto._get_extra_info('socket'))
+ default = object()
+ self.assertIs(ssl_proto._get_extra_info('socket', default), default)
+ self.connection_made(ssl_proto)
+ self.assertIsNotNone(ssl_proto._get_extra_info('socket'))
+ ssl_proto.connection_lost(None)
+ self.assertIsNone(ssl_proto._get_extra_info('socket'))
+
+
if __name__ == '__main__':
unittest.main()