MCPcopy Create free account
hub / github.com/apache/arrow / test_bytes_reader

Function test_bytes_reader

python/pyarrow/tests/test_io.py:274–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

272
273
274def test_bytes_reader():
275 # Like a BytesIO, but zero-copy underneath for C++ consumers
276 data = b'some sample data'
277 f = pa.BufferReader(data)
278 assert f.tell() == 0
279
280 assert f.size() == len(data)
281
282 assert f.read(4) == b'some'
283 assert f.tell() == 4
284
285 f.seek(0)
286 assert f.tell() == 0
287
288 f.seek(0, 2)
289 assert f.tell() == len(data)
290
291 f.seek(5)
292 assert f.tell() == 5
293
294 assert f.read(50) == b'sample data'
295
296 assert not f.closed
297 f.close()
298 assert f.closed
299
300
301def test_bytes_reader_non_bytes():

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
BufferReaderMethod · 0.80
seekMethod · 0.80
sizeMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected