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

Method test_incrementaldecoder

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

Source from the content-addressed store, hash-verified

191 self.assertEqual(ostream.getvalue(), self.tstring[0])
192
193 def test_incrementaldecoder(self):
194 UTF8Writer = codecs.getwriter('utf-8')
195 for sizehint in [None, -1] + list(range(1, 33)) + \
196 [64, 128, 256, 512, 1024]:
197 istream = BytesIO(self.tstring[0])
198 ostream = UTF8Writer(BytesIO())
199 decoder = self.incrementaldecoder()
200 while 1:
201 data = istream.read(sizehint)
202 if not data:
203 break
204 else:
205 u = decoder.decode(data)
206 ostream.write(u)
207
208 self.assertEqual(ostream.getvalue(), self.tstring[1])
209
210 def test_incrementalencoder_error_callback(self):
211 inv = self.unmappedunicode

Callers

nothing calls this directly

Calls 7

readMethod · 0.95
BytesIOClass · 0.90
listClass · 0.85
decodeMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected