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

Function check_compressed_input

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

Source from the content-addressed store, hash-verified

1606# Compressed input and output streams
1607
1608def check_compressed_input(data, fn, compression):
1609 raw = pa.OSFile(fn, mode="rb")
1610 with pa.CompressedInputStream(raw, compression) as compressed:
1611 assert not compressed.closed
1612 assert compressed.readable()
1613 assert not compressed.writable()
1614 assert not compressed.seekable()
1615 got = compressed.read()
1616 assert got == data
1617 assert compressed.closed
1618 assert raw.closed
1619
1620 # Same with read_buffer()
1621 raw = pa.OSFile(fn, mode="rb")
1622 with pa.CompressedInputStream(raw, compression) as compressed:
1623 buf = compressed.read_buffer()
1624 assert isinstance(buf, pa.Buffer)
1625 assert buf.to_pybytes() == data
1626
1627
1628@pytest.mark.gzip

Callers 2

Calls 3

writableMethod · 0.80
read_bufferMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected