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

Method test_incrementalencoder

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

Source from the content-addressed store, hash-verified

171 'test.cjktest')
172
173 def test_incrementalencoder(self):
174 UTF8Reader = codecs.getreader('utf-8')
175 for sizehint in [None] + list(range(1, 33)) + \
176 [64, 128, 256, 512, 1024]:
177 istream = UTF8Reader(BytesIO(self.tstring[1]))
178 ostream = BytesIO()
179 encoder = self.incrementalencoder()
180 while 1:
181 if sizehint is not None:
182 data = istream.read(sizehint)
183 else:
184 data = istream.read()
185
186 if not data:
187 break
188 e = encoder.encode(data)
189 ostream.write(e)
190
191 self.assertEqual(ostream.getvalue(), self.tstring[0])
192
193 def test_incrementaldecoder(self):
194 UTF8Writer = codecs.getwriter('utf-8')

Callers

nothing calls this directly

Calls 8

writeMethod · 0.95
getvalueMethod · 0.95
BytesIOClass · 0.90
listClass · 0.85
getreaderMethod · 0.80
readMethod · 0.45
encodeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected