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

Function test_v2_compression_options

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

Source from the content-addressed store, hash-verified

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