

def test_context(self):
    ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
    self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, self.server.port, keyfile=CERTFILE, context=ctx)
    self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, self.server.port, certfile=CERTFILE, context=ctx)
    self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, self.server.port, keyfile=CERTFILE, certfile=CERTFILE, context=ctx)
    self.client.quit()
    self.client = poplib.POP3_SSL(self.server.host, self.server.port, context=ctx)
    self.assertIsInstance(self.client.sock, ssl.SSLSocket)
    self.assertIs(self.client.sock.context, ctx)
    self.assertTrue(self.client.noop().startswith(b'+OK'))

dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_poplib.py TestPOP3_SSLClass.test_context/original