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

Method test_read_byteslike

Lib/test/test_io/test_textio.py:1171–1180  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1169 self.assertEqual("ok", out.decode().strip())
1170
1171 def test_read_byteslike(self):
1172 r = MemviewBytesIO(b'Just some random string\n')
1173 t = self.TextIOWrapper(r, 'utf-8')
1174
1175 # TextIOwrapper will not read the full string, because
1176 # we truncate it to a multiple of the native int size
1177 # so that we can construct a more complex memoryview.
1178 bytes_val = _to_memoryview(r.getvalue()).tobytes()
1179
1180 self.assertEqual(t.read(200), bytes_val.decode('utf-8'))
1181
1182 def test_issue22849(self):
1183 class F(object):

Callers

nothing calls this directly

Calls 6

readMethod · 0.95
MemviewBytesIOClass · 0.85
_to_memoryviewFunction · 0.85
getvalueMethod · 0.45
assertEqualMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected