MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_subclass

Method test_subclass

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

Source from the content-addressed store, hash-verified

1696 self.assertIn("NO_START_LINE", s)
1697
1698 def test_subclass(self):
1699 # Check that the appropriate SSLError subclass is raised
1700 # (this only tests one of them)
1701 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1702 ctx.check_hostname = False
1703 ctx.verify_mode = ssl.CERT_NONE
1704 with socket.create_server(("127.0.0.1", 0)) as s:
1705 c = socket.create_connection(s.getsockname())
1706 c.setblocking(False)
1707 with ctx.wrap_socket(c, False, do_handshake_on_connect=False) as c:
1708 with self.assertRaises(ssl.SSLWantReadError) as cm:
1709 c.do_handshake()
1710 s = str(cm.exception)
1711 self.assertStartsWith(s, "The operation did not complete (read)")
1712 # For compatibility
1713 self.assertEqual(cm.exception.errno, ssl.SSL_ERROR_WANT_READ)
1714
1715
1716 def test_bad_server_hostname(self):

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected