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

Method test_readline

Lib/test/test_asyncio/test_pep492.py:92–106  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

90class StreamReaderTests(BaseTest):
91
92 def test_readline(self):
93 DATA = b'line1\nline2\nline3'
94
95 stream = asyncio.StreamReader(loop=self.loop)
96 stream.feed_data(DATA)
97 stream.feed_eof()
98
99 async def reader():
100 data = []
101 async for line in stream:
102 data.append(line)
103 return data
104
105 data = self.loop.run_until_complete(reader())
106 self.assertEqual(data, [b'line1\n', b'line2\n', b'line3'])
107
108
109class CoroutineTests(BaseTest):

Callers

nothing calls this directly

Calls 5

feed_dataMethod · 0.95
feed_eofMethod · 0.95
readerFunction · 0.85
run_until_completeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected