@@ -206,15 +206,17 @@ def test_fwf_compression(self):
206
206
expected = read_fwf (StringIO (data ), widths = widths , names = names )
207
207
if compat .PY3 :
208
208
data = bytes (data , encoding = 'utf-8' )
209
- comps = [('gzip' , gzip .GzipFile ), ('bz2' , bz2 .BZ2File )]
210
- for comp_name , compresser in comps :
211
- with tm .ensure_clean () as path :
212
- tmp = compresser (path , mode = 'wb' )
213
- tmp .write (data )
214
- tmp .close ()
215
- result = read_fwf (path , widths = widths , names = names ,
216
- compression = comp_name )
217
- tm .assert_frame_equal (result , expected )
209
+ comps = [('gzip' , 'gz' , gzip .GzipFile ), ('bz2' , 'bz2' , bz2 .BZ2File )]
210
+ for comp_name , extension , compresser in comps :
211
+ for kwargs in [
212
+ {'compression' : comp_name }, {'compression' : 'infer' }, {}]:
213
+ with tm .ensure_clean (filename = 'tmp.%s' % extension ) as path :
214
+ tmp = compresser (path , mode = 'wb' )
215
+ tmp .write (data )
216
+ tmp .close ()
217
+ result = read_fwf (path , widths = widths , names = names ,
218
+ ** kwargs )
219
+ tm .assert_frame_equal (result , expected )
218
220
219
221
def test_comment_fwf (self ):
220
222
data = """
0 commit comments