MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_unexpected_error

Method test_unexpected_error

tests/test_server.py:321–329  ·  view source on GitHub ↗

accept() handles unexpected errors and returns an error response.

(self, process_request)

Source from the content-addressed store, hash-verified

319 side_effect=Exception("BOOM"),
320 )
321 def test_unexpected_error(self, process_request):
322 """accept() handles unexpected errors and returns an error response."""
323 server = ServerProtocol()
324 request = make_request()
325 response = server.accept(request)
326
327 self.assertEqual(response.status_code, 500)
328 self.assertIsInstance(server.handshake_exc, Exception)
329 self.assertEqual(str(server.handshake_exc), "BOOM")
330
331
332class HandshakeTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 3

acceptMethod · 0.95
ServerProtocolClass · 0.85
make_requestFunction · 0.85

Tested by

no test coverage detected