@@ -314,6 +314,7 @@ def TestReadCSVFixture():
314314 "test_read_csv_blank_lines" ,
315315 "test_read_csv_yes_no" ,
316316 "test_read_csv_nans" ,
317+ "test_read_csv_bad_lines" ,
317318 ]
318319 # each xdist worker spawned in separate process with separate namespace and dataset
319320 pytest .csvs_names = {file_id : get_unique_filename () for file_id in files_ids }
@@ -337,6 +338,11 @@ def TestReadCSVFixture():
337338 add_blank_lines = True ,
338339 additional_col_values = ["<NA>" , "N/A" , "NA" , "NULL" , "custom_nan" , "73" ],
339340 )
341+ # test_read_csv_error_handling
342+ _make_csv_file (filenames )(
343+ filename = pytest .csvs_names ["test_read_csv_bad_lines" ],
344+ add_bad_lines = True ,
345+ )
340346
341347 yield
342348 # Delete csv files that were created
@@ -860,6 +866,26 @@ def test_read_csv_iteration(self, make_csv_file, iterator):
860866
861867 df_equals (modin_df , pd_df )
862868
869+ # Error Handling parameters tests
870+ @pytest .mark .xfail (
871+ Engine .get () != "Python" ,
872+ reason = "read_csv with Ray engine doen't raise `bad lines` exceptions - issue #2500" ,
873+ )
874+ @pytest .mark .parametrize ("warn_bad_lines" , [True , False ])
875+ @pytest .mark .parametrize ("error_bad_lines" , [True , False ])
876+ def test_read_csv_error_handling (
877+ self ,
878+ warn_bad_lines ,
879+ error_bad_lines ,
880+ ):
881+ eval_io (
882+ fn_name = "read_csv" ,
883+ # read_csv kwargs
884+ filepath_or_buffer = pytest .csvs_names ["test_read_csv_bad_lines" ],
885+ warn_bad_lines = warn_bad_lines ,
886+ error_bad_lines = error_bad_lines ,
887+ )
888+
863889
864890def test_from_parquet (make_parquet_file ):
865891 make_parquet_file (NROWS )
0 commit comments