File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,21 @@ def test_read_csv_infer_compression(self):
157
157
158
158
inputs [3 ].close ()
159
159
160
+ def test_read_csv_infer_compression_pathlib (self ):
161
+ """
162
+ Test that compression is inferred from pathlib.Path paths.
163
+ """
164
+ try :
165
+ import pathlib
166
+ except ImportError :
167
+ pytest .skip ('need pathlib to run' )
168
+ expected = self .read_csv (self .csv1 , index_col = 0 , parse_dates = True )
169
+ for extension in '' , '.gz' , '.bz2' :
170
+ path = pathlib .Path (self .csv1 + extension )
171
+ df = self .read_csv (
172
+ path , index_col = 0 , parse_dates = True , compression = 'infer' )
173
+ tm .assert_frame_equal (expected , df )
174
+
160
175
def test_invalid_compression (self ):
161
176
msg = 'Unrecognized compression type: sfark'
162
177
with tm .assert_raises_regex (ValueError , msg ):
You can’t perform that action at this time.
0 commit comments