File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,21 @@ def test_read_csv_infer_compression(self):
166166
167167 inputs [3 ].close ()
168168
169+ def test_read_csv_infer_compression_pathlib (self ):
170+ """
171+ Test that compression is inferred from pathlib.Path paths.
172+ """
173+ try :
174+ import pathlib
175+ except ImportError :
176+ pytest .skip ('need pathlib to run' )
177+ expected = self .read_csv (self .csv1 , index_col = 0 , parse_dates = True )
178+ for extension in '' , '.gz' , '.bz2' :
179+ path = pathlib .Path (self .csv1 + extension )
180+ df = self .read_csv (
181+ path , index_col = 0 , parse_dates = True , compression = 'infer' )
182+ tm .assert_frame_equal (expected , df )
183+
169184 def test_invalid_compression (self ):
170185 msg = 'Unrecognized compression type: sfark'
171186 with tm .assert_raises_regex (ValueError , msg ):
You can’t perform that action at this time.
0 commit comments