(tmpdir)
| 2211 | |
| 2212 | @pytest.mark.gzip |
| 2213 | def test_output_stream_python_file(tmpdir): |
| 2214 | data = b"some test data\n" * 10 + b"eof\n" |
| 2215 | |
| 2216 | def check_data(data, **kwargs): |
| 2217 | # XXX cannot use BytesIO because stream.close() is necessary |
| 2218 | # to finish writing compressed data, but it will also close the |
| 2219 | # underlying BytesIO |
| 2220 | fn = str(tmpdir / 'output_stream_file') |
| 2221 | with open(fn, 'wb') as f: |
| 2222 | with pa.output_stream(f, **kwargs) as stream: |
| 2223 | stream.write(data) |
| 2224 | with open(fn, 'rb') as f: |
| 2225 | return f.read() |
| 2226 | |
| 2227 | assert check_data(data) == data |
| 2228 | assert gzip.decompress(check_data(data, compression='gzip')) == data |
| 2229 | |
| 2230 | |
| 2231 | def test_output_stream_errors(tmpdir): |
nothing calls this directly
no test coverage detected