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

Function test_input_stream_file_path_compressed

python/pyarrow/tests/test_io.py:1956–1973  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

1954
1955@pytest.mark.gzip
1956def test_input_stream_file_path_compressed(tmpdir):
1957 data = b"some test data\n" * 10 + b"eof\n"
1958 gz_data = gzip.compress(data)
1959 file_path = tmpdir / 'input_stream.gz'
1960 with open(str(file_path), 'wb') as f:
1961 f.write(gz_data)
1962
1963 stream = pa.input_stream(file_path)
1964 assert stream.read() == data
1965 stream = pa.input_stream(str(file_path))
1966 assert stream.read() == data
1967 stream = pa.input_stream(pathlib.Path(str(file_path)))
1968 assert stream.read() == data
1969
1970 stream = pa.input_stream(file_path, compression='gzip')
1971 assert stream.read() == data
1972 stream = pa.input_stream(file_path, compression=None)
1973 assert stream.read() == gz_data
1974
1975
1976def test_input_stream_file_path_buffered(tmpdir):

Callers

nothing calls this directly

Calls 3

writeMethod · 0.45
readMethod · 0.45
PathMethod · 0.45

Tested by

no test coverage detected