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

Method test_stream_bare

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

Source from the content-addressed store, hash-verified

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