@@ -241,3 +241,24 @@ def test_compression_size(obj, method, compression):
241
241
getattr (obj , method )(filename , compression = None )
242
242
uncompressed = os .path .getsize (filename )
243
243
assert uncompressed > compressed
244
+
245
+
246
+ @pytest .mark .parametrize ('obj' , [
247
+ DataFrame (100 * [[0.123456 , 0.234567 , 0.567567 ],
248
+ [12.32112 , 123123.2 , 321321.2 ]],
249
+ columns = ['X' , 'Y' , 'Z' ]),
250
+ Series (100 * [0.123456 , 0.234567 , 0.567567 ], name = 'X' )])
251
+ @pytest .mark .parametrize ('method' , ['to_csv' ])
252
+ def test_compression_size_fh (obj , method , compression ):
253
+ if not compression :
254
+ pytest .skip ("only test compression case." )
255
+
256
+ with tm .ensure_clean () as filename :
257
+ with open (filename , 'w' ) as fh :
258
+ getattr (obj , method )(fh , compression = compression )
259
+ compressed = os .path .getsize (filename )
260
+ with tm .ensure_clean () as filename :
261
+ with open (filename , 'w' ) as fh :
262
+ getattr (obj , method )(fh , compression = None )
263
+ uncompressed = os .path .getsize (filename )
264
+ assert uncompressed > compressed
0 commit comments