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

Function test_v2_compression_options

python/pyarrow/tests/test_feather.py:651–685  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

649@pytest.mark.snappy
650@pytest.mark.zstd
651def test_v2_compression_options():
652 df = pd.DataFrame({'A': np.arange(1000)})
653
654 cases = [
655 # compression, compression_level
656 ('uncompressed', None),
657 ('lz4', None),
658 ('lz4', 1),
659 ('lz4', 12),
660 ('zstd', 1),
661 ('zstd', 10)
662 ]
663
664 for compression, compression_level in cases:
665 _check_pandas_roundtrip(df, compression=compression,
666 compression_level=compression_level)
667
668 buf = io.BytesIO()
669
670 # Trying to compress with V1
671 with pytest.raises(
672 ValueError,
673 match="Feather V1 files do not support compression option"):
674 write_feather(df, buf, compression='lz4', version=1)
675
676 # Trying to set chunksize with V1
677 with pytest.raises(
678 ValueError,
679 match="Feather V1 files do not support chunksize option"):
680 write_feather(df, buf, chunksize=4096, version=1)
681
682 # Unsupported compressor
683 with pytest.raises(ValueError,
684 match='compression="snappy" not supported'):
685 write_feather(df, buf, compression='snappy')
686
687
688@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

write_featherFunction · 0.90
_check_pandas_roundtripFunction · 0.70

Tested by

no test coverage detected