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

Method test_read

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

Source from the content-addressed store, hash-verified

143 self.assertEqual(self.DATA, stream._buffer)
144
145 def test_read(self):
146 # Read bytes.
147 stream = asyncio.StreamReader(loop=self.loop)
148 read_task = self.loop.create_task(stream.read(30))
149
150 def cb():
151 stream.feed_data(self.DATA)
152 self.loop.call_soon(cb)
153
154 data = self.loop.run_until_complete(read_task)
155 self.assertEqual(self.DATA, data)
156 self.assertEqual(b'', stream._buffer)
157
158 def test_read_line_breaks(self):
159 # Read bytes without line breaks.

Callers

nothing calls this directly

Calls 5

readMethod · 0.95
create_taskMethod · 0.45
call_soonMethod · 0.45
run_until_completeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected