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

Function test_input_stream_python_file

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

Source from the content-addressed store, hash-verified

2017
2018@pytest.mark.gzip
2019def test_input_stream_python_file(tmpdir):
2020 data = b"some test data\n" * 10 + b"eof\n"
2021 bio = BytesIO(data)
2022
2023 stream = pa.input_stream(bio)
2024 assert stream.read() == data
2025
2026 gz_data = gzip.compress(data)
2027 bio = BytesIO(gz_data)
2028 stream = pa.input_stream(bio)
2029 assert stream.read() == gz_data
2030 bio.seek(0)
2031 stream = pa.input_stream(bio, compression='gzip')
2032 assert stream.read() == data
2033
2034 file_path = tmpdir / 'input_stream'
2035 with open(str(file_path), 'wb') as f:
2036 f.write(data)
2037 with open(str(file_path), 'rb') as f:
2038 stream = pa.input_stream(f)
2039 assert stream.read() == data
2040
2041
2042@pytest.mark.gzip

Callers

nothing calls this directly

Calls 3

seekMethod · 0.80
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected