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

Function test_bytes_reader

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

Source from the content-addressed store, hash-verified

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