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

Function test_v2_compression_options

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

Source from the content-addressed store, hash-verified

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