MCPcopy Index your code
hub / github.com/python/cpython / test_version_basic

Method test_version_basic

Lib/test/test_ssl.py:4165–4182  ·  view source on GitHub ↗

Basic tests for SSLSocket.version(). More tests are done in the test_protocol_*() methods.

(self)

Source from the content-addressed store, hash-verified

4163 self.assertIsNone(s.group())
4164
4165 def test_version_basic(self):
4166 """
4167 Basic tests for SSLSocket.version().
4168 More tests are done in the test_protocol_*() methods.
4169 """
4170 context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
4171 context.check_hostname = False
4172 context.verify_mode = ssl.CERT_NONE
4173 with ThreadedEchoServer(CERTFILE,
4174 ssl_version=ssl.PROTOCOL_TLS_SERVER,
4175 chatty=False) as server:
4176 with context.wrap_socket(socket.socket()) as s:
4177 self.assertIs(s.version(), None)
4178 self.assertIs(s._sslobj, None)
4179 s.connect((HOST, server.port))
4180 self.assertEqual(s.version(), 'TLSv1.3')
4181 self.assertIs(s._sslobj, None)
4182 self.assertIs(s.version(), None)
4183
4184 @requires_tls_version('TLSv1_3')
4185 def test_tls1_3(self):

Callers

nothing calls this directly

Calls 7

wrap_socketMethod · 0.95
ThreadedEchoServerClass · 0.85
socketMethod · 0.80
assertIsMethod · 0.45
versionMethod · 0.45
connectMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected