MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_stream_bare

Method test_stream_bare

Lib/test/test_codecs.py:1144–1164  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1142 self.assertEqual(got, unistring)
1143
1144 def test_stream_bare(self):
1145 unistring = "ABC\u00A1\u2200XYZ"
1146 bytestring = b"ABC\xC2\xA1\xE2\x88\x80XYZ"
1147
1148 reader = codecs.getreader("utf-8-sig")
1149 for sizehint in [None] + list(range(1, 11)) + \
1150 [64, 128, 256, 512, 1024]:
1151 istream = reader(io.BytesIO(bytestring))
1152 ostream = io.StringIO()
1153 while 1:
1154 if sizehint is not None:
1155 data = istream.read(sizehint)
1156 else:
1157 data = istream.read()
1158
1159 if not data:
1160 break
1161 ostream.write(data)
1162
1163 got = ostream.getvalue()
1164 self.assertEqual(got, unistring)
1165
1166
1167class EscapeDecodeTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 7

getvalueMethod · 0.95
listClass · 0.85
readerFunction · 0.85
getreaderMethod · 0.80
readMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected