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

Function check_compressed_input

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

Source from the content-addressed store, hash-verified

1598# Compressed input and output streams
1599
1600def check_compressed_input(data, fn, compression):
1601 raw = pa.OSFile(fn, mode="rb")
1602 with pa.CompressedInputStream(raw, compression) as compressed:
1603 assert not compressed.closed
1604 assert compressed.readable()
1605 assert not compressed.writable()
1606 assert not compressed.seekable()
1607 got = compressed.read()
1608 assert got == data
1609 assert compressed.closed
1610 assert raw.closed
1611
1612 # Same with read_buffer()
1613 raw = pa.OSFile(fn, mode="rb")
1614 with pa.CompressedInputStream(raw, compression) as compressed:
1615 buf = compressed.read_buffer()
1616 assert isinstance(buf, pa.Buffer)
1617 assert buf.to_pybytes() == data
1618
1619
1620@pytest.mark.gzip

Callers 2

Calls 3

writableMethod · 0.80
read_bufferMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected