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

Method test_sendfile

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

Source from the content-addressed store, hash-verified

4345 self.assertRaises(ValueError, s.write, b'hello')
4346
4347 def test_sendfile(self):
4348 TEST_DATA = b"x" * 512
4349 with open(os_helper.TESTFN, 'wb') as f:
4350 f.write(TEST_DATA)
4351 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
4352 client_context, server_context, hostname = testing_context()
4353 server = ThreadedEchoServer(context=server_context, chatty=False)
4354 with server:
4355 with client_context.wrap_socket(socket.socket(),
4356 server_hostname=hostname) as s:
4357 s.connect((HOST, server.port))
4358 with open(os_helper.TESTFN, 'rb') as file:
4359 s.sendfile(file)
4360 self.assertEqual(s.recv(1024), TEST_DATA)
4361
4362 @unittest.expectedFailure # TODO: RUSTPYTHON
4363 def test_session(self):

Callers

nothing calls this directly

Calls 11

testing_contextFunction · 0.85
ThreadedEchoServerClass · 0.85
addCleanupMethod · 0.80
wrap_socketMethod · 0.80
socketMethod · 0.80
openFunction · 0.50
writeMethod · 0.45
connectMethod · 0.45
sendfileMethod · 0.45
assertEqualMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected