MCPcopy
hub / github.com/aio-libs/aiohttp / test_close_exc2

Method test_close_exc2

tests/test_web_websocket.py:382–398  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

380 self.assertEqual(ws.close_code, 1006)
381
382 def test_close_exc2(self):
383 req = self.make_request('GET', '/')
384 ws = WebSocketResponse()
385 self.loop.run_until_complete(ws.prepare(req))
386
387 exc = ValueError()
388 self.writer.close.side_effect = exc
389 ws._writer = self.writer
390
391 self.loop.run_until_complete(ws.close())
392 self.assertTrue(ws.closed)
393 self.assertIs(ws.exception(), exc)
394
395 ws._closed = False
396 self.writer.close.side_effect = asyncio.CancelledError()
397 self.assertRaises(asyncio.CancelledError,
398 self.loop.run_until_complete, ws.close())
399
400 def test_start_twice_idempotent(self):
401 req = self.make_request('GET', '/')

Callers

nothing calls this directly

Calls 5

make_requestMethod · 0.95
prepareMethod · 0.95
closeMethod · 0.95
exceptionMethod · 0.95
WebSocketResponseClass · 0.90

Tested by

no test coverage detected