(tmpdir)
| 1614 | |
| 1615 | @pytest.mark.gzip |
| 1616 | def test_compressed_input_openfile(tmpdir): |
| 1617 | if not Codec.is_available("gzip"): |
| 1618 | pytest.skip("gzip support is not built") |
| 1619 | |
| 1620 | data = b"some test data\n" * 10 + b"eof\n" |
| 1621 | fn = str(tmpdir / "test_compressed_input_openfile.gz") |
| 1622 | with gzip.open(fn, "wb") as f: |
| 1623 | f.write(data) |
| 1624 | |
| 1625 | with pa.CompressedInputStream(fn, "gzip") as compressed: |
| 1626 | buf = compressed.read_buffer() |
| 1627 | assert buf.to_pybytes() == data |
| 1628 | assert compressed.closed |
| 1629 | |
| 1630 | with pa.CompressedInputStream(pathlib.Path(fn), "gzip") as compressed: |
| 1631 | buf = compressed.read_buffer() |
| 1632 | assert buf.to_pybytes() == data |
| 1633 | assert compressed.closed |
| 1634 | |
| 1635 | f = open(fn, "rb") |
| 1636 | with pa.CompressedInputStream(f, "gzip") as compressed: |
| 1637 | buf = compressed.read_buffer() |
| 1638 | assert buf.to_pybytes() == data |
| 1639 | assert f.closed |
| 1640 | |
| 1641 | |
| 1642 | def check_compressed_concatenated(data, fn, compression): |
nothing calls this directly
no test coverage detected