MCPcopy Index your code
hub / github.com/python/cpython / test_read_exception

Method test_read_exception

Lib/test/test_asyncio/test_streams.py:198–207  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196 self.assertEqual(b'', stream._buffer)
197
198 def test_read_exception(self):
199 stream = asyncio.StreamReader(loop=self.loop)
200 stream.feed_data(b'line\n')
201
202 data = self.loop.run_until_complete(stream.read(2))
203 self.assertEqual(b'li', data)
204
205 stream.set_exception(ValueError())
206 self.assertRaises(
207 ValueError, self.loop.run_until_complete, stream.read(2))
208
209 def test_invalid_limit(self):
210 with self.assertRaisesRegex(ValueError, 'imit'):

Callers

nothing calls this directly

Calls 6

feed_dataMethod · 0.95
readMethod · 0.95
set_exceptionMethod · 0.95
run_until_completeMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected