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

Method test_read_byteslike

Lib/test/test_io.py:3831–3840  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3829 self.assertEqual("ok", out.decode().strip())
3830
3831 def test_read_byteslike(self):
3832 r = MemviewBytesIO(b'Just some random string\n')
3833 t = self.TextIOWrapper(r, 'utf-8')
3834
3835 # TextIOwrapper will not read the full string, because
3836 # we truncate it to a multiple of the native int size
3837 # so that we can construct a more complex memoryview.
3838 bytes_val = _to_memoryview(r.getvalue()).tobytes()
3839
3840 self.assertEqual(t.read(200), bytes_val.decode('utf-8'))
3841
3842 def test_issue22849(self):
3843 class F(object):

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected