@@ -156,13 +156,33 @@ def test_with_missing_lzma_runtime():
156
156
],
157
157
)
158
158
@pytest .mark .parametrize ("method" , ["to_pickle" , "to_json" , "to_csv" ])
159
- def test_gzip_compression_level_path (obj , method ):
160
- """GH#33398 Ideally this test should be repeated for bz2 as well,
161
- but that is not practical because a file size of >100k is needed to see any
162
- size difference between bz2 compression settings."""
159
+ def test_gzip_compression_level (obj , method ):
160
+ #GH33196
163
161
with tm .ensure_clean () as path :
164
162
getattr (obj , method )(path , compression = "gzip" )
165
163
compressed_size_default = os .path .getsize (path )
166
- getattr (obj , method )(path , compression = {"method" : "gzip" , "compresslevel" : 1 })
164
+ getattr (obj , method )(
165
+ path , compression = { "method" : "gzip" , "compresslevel" : 1 })
167
166
compressed_size_fast = os .path .getsize (path )
168
167
assert compressed_size_default < compressed_size_fast
168
+
169
+
170
+ @pytest .mark .parametrize (
171
+ "obj" ,
172
+ [
173
+ pd .DataFrame (
174
+ 100 * [[0.123456 , 0.234567 , 0.567567 ], [12.32112 , 123123.2 , 321321.2 ]],
175
+ columns = ["X" , "Y" , "Z" ],
176
+ ),
177
+ pd .Series (100 * [0.123456 , 0.234567 , 0.567567 ], name = "X" ),
178
+ ],
179
+ )
180
+ @pytest .mark .parametrize ("method" , ["to_pickle" , "to_json" , "to_csv" ])
181
+ def test_bzip_compression_level (obj , method ):
182
+ """GH33196 bzip needs file size > 100k to show a size difference between
183
+ compression levels, so here we just check if the call works when
184
+ compression is passed as a dict.
185
+ """
186
+ with tm .ensure_clean () as path :
187
+ getattr (obj , method )(
188
+ path , compression = { "method" : "bz2" , "compresslevel" : 1 })
0 commit comments