@@ -491,15 +491,14 @@ def test_read_csv_names(self, tmp_path):
491491        assert  rel .columns  ==  ["a" , "b" , "c" , "four" ]
492492
493493        with  pytest .raises (duckdb .InvalidInputException , match = "read_csv only accepts 'names' as a list of strings" ):
494-             rel   =   con .read_csv (file , names = True )
494+             con .read_csv (file , names = True )
495495
496496        with  pytest .raises (duckdb .InvalidInputException , match = "not possible to detect the CSV Header" ):
497-             rel   =   con .read_csv (file , names = ["a" , "b" , "c" , "d" , "e" ])
497+             con .read_csv (file , names = ["a" , "b" , "c" , "d" , "e" ])
498498
499499        # Duplicates are not okay 
500500        with  pytest .raises (duckdb .BinderException , match = "names must have unique values" ):
501-             rel  =  con .read_csv (file , names = ["a" , "b" , "a" , "b" ])
502-             assert  rel .columns  ==  ["a" , "b" , "a" , "b" ]
501+             con .read_csv (file , names = ["a" , "b" , "a" , "b" ])
503502
504503    def  test_read_csv_names_mixed_with_dtypes (self , tmp_path ):
505504        file  =  tmp_path  /  "file.csv" 
@@ -565,8 +564,7 @@ def test_read_csv_empty_list(self):
565564        with  pytest .raises (
566565            duckdb .InvalidInputException , match = "Please provide a non-empty list of paths or file-like objects" 
567566        ):
568-             rel  =  con .read_csv (files )
569-             rel .fetchall ()
567+             con .read_csv (files )
570568
571569    def  test_read_auto_detect (self , tmp_path ):
572570        file1  =  tmp_path  /  "file1.csv" 
@@ -587,8 +585,7 @@ def test_read_csv_list_invalid_path(self, tmp_path):
587585
588586        files  =  [str (file1 ), "not_valid_path" , str (file3 )]
589587        with  pytest .raises (duckdb .IOException , match = 'No files found that match the pattern "not_valid_path"' ):
590-             rel  =  con .read_csv (files )
591-             rel .fetchall ()
588+             con .read_csv (files )
592589
593590    @pytest .mark .parametrize ( 
594591        "options" , 
@@ -672,15 +669,16 @@ def test_strict_mode(self, tmp_path):
672669        file1 .write_text ("one|two|three|four\n 1|2|3|4\n 1|2|3|4|5\n 1|2|3|4\n " )
673670
674671        con  =  duckdb .connect ()
672+         rel  =  con .read_csv (
673+             str (file1 ),
674+             header = True ,
675+             delimiter = "|" ,
676+             columns = {"a" : "INTEGER" , "b" : "INTEGER" , "c" : "INTEGER" , "d" : "INTEGER" },
677+             auto_detect = False ,
678+         )
675679        with  pytest .raises (duckdb .InvalidInputException , match = "CSV Error on Line" ):
676-             rel  =  con .read_csv (
677-                 str (file1 ),
678-                 header = True ,
679-                 delimiter = "|" ,
680-                 columns = {"a" : "INTEGER" , "b" : "INTEGER" , "c" : "INTEGER" , "d" : "INTEGER" },
681-                 auto_detect = False ,
682-             )
683680            rel .fetchall ()
681+ 
684682        rel  =  con .read_csv (
685683            str (file1 ),
686684            header = True ,
@@ -734,8 +732,8 @@ def test_files_to_sniff_option(self, tmp_path):
734732
735733        file_path  =  tmp_path  /  "file*.csv" 
736734        con  =  duckdb .connect ()
735+         rel  =  con .read_csv (file_path , files_to_sniff = 1 )
737736        with  pytest .raises (duckdb .ConversionException , match = "Conversion Error" ):
738-             rel  =  con .read_csv (file_path , files_to_sniff = 1 )
739737            rel .fetchall ()
740738        rel  =  con .read_csv (file_path , files_to_sniff = - 1 )
741739        assert  rel .fetchall () ==  [("2025-05-12" , "baz" ), ("bar" , "baz" )]
0 commit comments