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

Method test_streamreader

Lib/test/multibytecodec_support.py:230–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

228 self.assertEqual(e.encode(inv, True), b'')
229
230 def test_streamreader(self):
231 UTF8Writer = codecs.getwriter('utf-8')
232 for name in ["read", "readline", "readlines"]:
233 for sizehint in [None, -1] + list(range(1, 33)) + \
234 [64, 128, 256, 512, 1024]:
235 istream = self.reader(BytesIO(self.tstring[0]))
236 ostream = UTF8Writer(BytesIO())
237 func = getattr(istream, name)
238 while 1:
239 data = func(sizehint)
240 if not data:
241 break
242 if name == "readlines":
243 ostream.writelines(data)
244 else:
245 ostream.write(data)
246
247 self.assertEqual(ostream.getvalue(), self.tstring[1])
248
249 def test_streamwriter(self):
250 readfuncs = ('read', 'readline', 'readlines')

Callers

nothing calls this directly

Calls 8

BytesIOClass · 0.90
listClass · 0.85
funcFunction · 0.70
readerMethod · 0.45
writelinesMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected