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

Method test_subclass

Lib/test/test_ssl.py:1915–1930  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1913 self.assertIn("NO_START_LINE", s)
1914
1915 def test_subclass(self):
1916 # Check that the appropriate SSLError subclass is raised
1917 # (this only tests one of them)
1918 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1919 ctx.check_hostname = False
1920 ctx.verify_mode = ssl.CERT_NONE
1921 with socket.create_server(("127.0.0.1", 0)) as s:
1922 c = socket.create_connection(s.getsockname())
1923 c.setblocking(False)
1924 with ctx.wrap_socket(c, False, do_handshake_on_connect=False) as c:
1925 with self.assertRaises(ssl.SSLWantReadError) as cm:
1926 c.do_handshake()
1927 s = str(cm.exception)
1928 self.assertStartsWith(s, "The operation did not complete (read)")
1929 # For compatibility
1930 self.assertEqual(cm.exception.errno, ssl.SSL_ERROR_WANT_READ)
1931
1932
1933 def test_bad_server_hostname(self):

Callers

nothing calls this directly

Calls 10

wrap_socketMethod · 0.95
strFunction · 0.85
assertStartsWithMethod · 0.80
create_serverMethod · 0.45
create_connectionMethod · 0.45
getsocknameMethod · 0.45
setblockingMethod · 0.45
assertRaisesMethod · 0.45
do_handshakeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected