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

Method test_exception_cancel

tests/test_streams.py:438–452  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

436 self.assertRaises(ValueError, t1.result)
437
438 def test_exception_cancel(self):
439 stream = self._make_one()
440
441 @asyncio.coroutine
442 def read_a_line():
443 yield from stream.readline()
444
445 t = asyncio.Task(read_a_line(), loop=self.loop)
446 test_utils.run_briefly(self.loop)
447 t.cancel()
448 test_utils.run_briefly(self.loop)
449 # The following line fails if set_exception() isn't careful.
450 stream.set_exception(RuntimeError('message'))
451 test_utils.run_briefly(self.loop)
452 self.assertIs(stream._waiter, None)
453
454 def test_readany_eof(self):
455 stream = self._make_one()

Callers

nothing calls this directly

Calls 2

_make_oneMethod · 0.95
set_exceptionMethod · 0.45

Tested by

no test coverage detected