(self)
| 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): |
nothing calls this directly
no test coverage detected