Skip to content

Commit a790148

Browse files
committed
add compression size test case
1 parent 012383f commit a790148

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/io/test_pickle.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,21 @@ def test_read_infer(self, ext, get_random_path):
457457

458458
tm.assert_frame_equal(df, df2)
459459

460+
def test_compression_size(self, compression):
461+
462+
df = pd.concat(100 * [pd.DataFrame([[0.123456, 0.234567, 0.567567],
463+
[12.32112, 123123.2, 321321.2]],
464+
columns=['X', 'Y', 'Z'])])
465+
466+
with tm.ensure_clean() as filename:
467+
import os
468+
df.to_pickle(filename, compression=compression)
469+
file_size = os.path.getsize(filename)
470+
471+
if compression:
472+
df.to_pickle(filename, compression=None)
473+
uncompressed_file_size = os.path.getsize(filename)
474+
assert uncompressed_file_size > file_size
460475

461476
# ---------------------
462477
# test pickle compression

0 commit comments

Comments
 (0)