| 2017 | |
| 2018 | @pytest.mark.gzip |
| 2019 | def 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 |