diff options
author | Yury Selivanov <yselivanov@gmail.com> | 2017-03-12 21:06:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-12 21:06:16 (GMT) |
commit | 99f8d33a94c8951fd6b2d5f079d20be698150993 (patch) | |
tree | 7acd7af9e67bb75ab3c1458464bc8305d71dcb6b /Lib/test/test_asyncio | |
parent | fa448de97de85d242491d7ad259ade0732f05db8 (diff) | |
download | cpython-99f8d33a94c8951fd6b2d5f079d20be698150993.zip cpython-99f8d33a94c8951fd6b2d5f079d20be698150993.tar.gz cpython-99f8d33a94c8951fd6b2d5f079d20be698150993.tar.bz2 |
bpo-29742: asyncio get_extra_info() throws exception (#525) (#645)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_sslproto.py | 12 |
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 59ff0f6..f1771c5 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() |