(tmpdir)
| 2087 | |
| 2088 | @pytest.mark.gzip |
| 2089 | def test_output_stream_file_path_compressed(tmpdir): |
| 2090 | data = b"some test data\n" * 10 + b"eof\n" |
| 2091 | file_path = tmpdir / 'output_stream.gz' |
| 2092 | |
| 2093 | def check_data(file_path, data, **kwargs): |
| 2094 | with pa.output_stream(file_path, **kwargs) as stream: |
| 2095 | stream.write(data) |
| 2096 | with open(str(file_path), 'rb') as f: |
| 2097 | return f.read() |
| 2098 | |
| 2099 | assert gzip.decompress(check_data(file_path, data)) == data |
| 2100 | assert gzip.decompress(check_data(str(file_path), data)) == data |
| 2101 | assert gzip.decompress( |
| 2102 | check_data(pathlib.Path(str(file_path)), data)) == data |
| 2103 | |
| 2104 | assert gzip.decompress( |
| 2105 | check_data(file_path, data, compression='gzip')) == data |
| 2106 | assert check_data(file_path, data, compression=None) == data |
| 2107 | |
| 2108 | with pytest.raises(ValueError, match='Invalid value for compression'): |
| 2109 | assert check_data(file_path, data, compression='rabbit') == data |
| 2110 | |
| 2111 | |
| 2112 | def test_output_stream_file_path_buffered(tmpdir): |
nothing calls this directly
no test coverage detected