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

Function check_compressed_input

python/pyarrow/tests/test_io.py:1575–1592  ·  view source on GitHub ↗
(data, fn, compression)

Source from the content-addressed store, hash-verified

1573# Compressed input and output streams
1574
1575def check_compressed_input(data, fn, compression):
1576 raw = pa.OSFile(fn, mode="rb")
1577 with pa.CompressedInputStream(raw, compression) as compressed:
1578 assert not compressed.closed
1579 assert compressed.readable()
1580 assert not compressed.writable()
1581 assert not compressed.seekable()
1582 got = compressed.read()
1583 assert got == data
1584 assert compressed.closed
1585 assert raw.closed
1586
1587 # Same with read_buffer()
1588 raw = pa.OSFile(fn, mode="rb")
1589 with pa.CompressedInputStream(raw, compression) as compressed:
1590 buf = compressed.read_buffer()
1591 assert isinstance(buf, pa.Buffer)
1592 assert buf.to_pybytes() == data
1593
1594
1595@pytest.mark.gzip

Callers 2

Calls 3

writableMethod · 0.80
read_bufferMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected