@@ -119,7 +119,6 @@ def test_read_csv_local(all_parsers, csv1):
119119 tm .assert_frame_equal (result , expected )
120120
121121
122- @xfail_pyarrow
123122def test_1000_sep (all_parsers ):
124123 parser = all_parsers
125124 data = """A|B|C
@@ -128,6 +127,12 @@ def test_1000_sep(all_parsers):
128127"""
129128 expected = DataFrame ({"A" : [1 , 10 ], "B" : [2334 , 13 ], "C" : [5 , 10.0 ]})
130129
130+ if parser .engine == "pyarrow" :
131+ msg = "The 'thousands' option is not supported with the 'pyarrow' engine"
132+ with pytest .raises (ValueError , match = msg ):
133+ parser .read_csv (StringIO (data ), sep = "|" , thousands = "," )
134+ return
135+
131136 result = parser .read_csv (StringIO (data ), sep = "|" , thousands = "," )
132137 tm .assert_frame_equal (result , expected )
133138
@@ -161,7 +166,6 @@ def test_csv_mixed_type(all_parsers):
161166 tm .assert_frame_equal (result , expected )
162167
163168
164- @xfail_pyarrow
165169def test_read_csv_low_memory_no_rows_with_index (all_parsers ):
166170 # see gh-21141
167171 parser = all_parsers
@@ -174,6 +178,13 @@ def test_read_csv_low_memory_no_rows_with_index(all_parsers):
1741782,2,3,4
1751793,3,4,5
176180"""
181+
182+ if parser .engine == "pyarrow" :
183+ msg = "The 'nrows' option is not supported with the 'pyarrow' engine"
184+ with pytest .raises (ValueError , match = msg ):
185+ parser .read_csv (StringIO (data ), low_memory = True , index_col = 0 , nrows = 0 )
186+ return
187+
177188 result = parser .read_csv (StringIO (data ), low_memory = True , index_col = 0 , nrows = 0 )
178189 expected = DataFrame (columns = ["A" , "B" , "C" ])
179190 tm .assert_frame_equal (result , expected )
@@ -212,7 +223,6 @@ def test_read_csv_dataframe(all_parsers, csv1):
212223 tm .assert_frame_equal (result , expected )
213224
214225
215- @xfail_pyarrow
216226@pytest .mark .parametrize ("nrows" , [3 , 3.0 ])
217227def test_read_nrows (all_parsers , nrows ):
218228 # see gh-10476
@@ -230,11 +240,16 @@ def test_read_nrows(all_parsers, nrows):
230240 )
231241 parser = all_parsers
232242
243+ if parser .engine == "pyarrow" :
244+ msg = "The 'nrows' option is not supported with the 'pyarrow' engine"
245+ with pytest .raises (ValueError , match = msg ):
246+ parser .read_csv (StringIO (data ), nrows = nrows )
247+ return
248+
233249 result = parser .read_csv (StringIO (data ), nrows = nrows )
234250 tm .assert_frame_equal (result , expected )
235251
236252
237- @xfail_pyarrow
238253@pytest .mark .parametrize ("nrows" , [1.2 , "foo" , - 1 ])
239254def test_read_nrows_bad (all_parsers , nrows ):
240255 data = """index,A,B,C,D
@@ -247,6 +262,8 @@ def test_read_nrows_bad(all_parsers, nrows):
247262"""
248263 msg = r"'nrows' must be an integer >=0"
249264 parser = all_parsers
265+ if parser .engine == "pyarrow" :
266+ msg = "The 'nrows' option is not supported with the 'pyarrow' engine"
250267
251268 with pytest .raises (ValueError , match = msg ):
252269 parser .read_csv (StringIO (data ), nrows = nrows )
@@ -277,7 +294,6 @@ def test_missing_trailing_delimiters(all_parsers):
277294 tm .assert_frame_equal (result , expected )
278295
279296
280- @xfail_pyarrow
281297def test_skip_initial_space (all_parsers ):
282298 data = (
283299 '"09-Apr-2012", "01:10:18.300", 2456026.548822908, 12849, '
@@ -289,6 +305,18 @@ def test_skip_initial_space(all_parsers):
289305 )
290306 parser = all_parsers
291307
308+ if parser .engine == "pyarrow" :
309+ msg = "The 'skipinitialspace' option is not supported with the 'pyarrow' engine"
310+ with pytest .raises (ValueError , match = msg ):
311+ parser .read_csv (
312+ StringIO (data ),
313+ names = list (range (33 )),
314+ header = None ,
315+ na_values = ["-9999.0" ],
316+ skipinitialspace = True ,
317+ )
318+ return
319+
292320 result = parser .read_csv (
293321 StringIO (data ),
294322 names = list (range (33 )),
@@ -437,7 +465,6 @@ def test_read_empty_with_usecols(all_parsers, data, kwargs, expected):
437465 tm .assert_frame_equal (result , expected )
438466
439467
440- @xfail_pyarrow
441468@pytest .mark .parametrize (
442469 "kwargs,expected" ,
443470 [
@@ -467,6 +494,12 @@ def test_trailing_spaces(all_parsers, kwargs, expected):
467494 data = "A B C \n random line with trailing spaces \n skip\n 1,2,3\n 1,2.,4.\n random line with trailing tabs\t \t \t \n \n 5.1,NaN,10.0\n " # noqa: E501
468495 parser = all_parsers
469496
497+ if parser .engine == "pyarrow" :
498+ msg = "The 'delim_whitespace' option is not supported with the 'pyarrow' engine"
499+ with pytest .raises (ValueError , match = msg ):
500+ parser .read_csv (StringIO (data .replace ("," , " " )), ** kwargs )
501+ return
502+
470503 result = parser .read_csv (StringIO (data .replace ("," , " " )), ** kwargs )
471504 tm .assert_frame_equal (result , expected )
472505
@@ -488,7 +521,6 @@ def test_read_filepath_or_buffer(all_parsers):
488521 parser .read_csv (filepath_or_buffer = b"input" )
489522
490523
491- @xfail_pyarrow
492524@pytest .mark .parametrize ("delim_whitespace" , [True , False ])
493525def test_single_char_leading_whitespace (all_parsers , delim_whitespace ):
494526 # see gh-9710
@@ -501,6 +533,15 @@ def test_single_char_leading_whitespace(all_parsers, delim_whitespace):
501533b\n """
502534
503535 expected = DataFrame ({"MyColumn" : list ("abab" )})
536+
537+ if parser .engine == "pyarrow" :
538+ msg = "The 'skipinitialspace' option is not supported with the 'pyarrow' engine"
539+ with pytest .raises (ValueError , match = msg ):
540+ parser .read_csv (
541+ StringIO (data ), skipinitialspace = True , delim_whitespace = delim_whitespace
542+ )
543+ return
544+
504545 result = parser .read_csv (
505546 StringIO (data ), skipinitialspace = True , delim_whitespace = delim_whitespace
506547 )
@@ -688,7 +729,6 @@ def test_first_row_bom_unquoted(all_parsers):
688729 tm .assert_frame_equal (result , expected )
689730
690731
691- @xfail_pyarrow
692732@pytest .mark .parametrize ("nrows" , range (1 , 6 ))
693733def test_blank_lines_between_header_and_data_rows (all_parsers , nrows ):
694734 # GH 28071
@@ -698,6 +738,15 @@ def test_blank_lines_between_header_and_data_rows(all_parsers, nrows):
698738 )
699739 csv = "\n header\n \n a,b\n \n \n 1,2\n \n 3,4"
700740 parser = all_parsers
741+
742+ if parser .engine == "pyarrow" :
743+ msg = "The 'nrows' option is not supported with the 'pyarrow' engine"
744+ with pytest .raises (ValueError , match = msg ):
745+ parser .read_csv (
746+ StringIO (csv ), header = 3 , nrows = nrows , skip_blank_lines = False
747+ )
748+ return
749+
701750 df = parser .read_csv (StringIO (csv ), header = 3 , nrows = nrows , skip_blank_lines = False )
702751 tm .assert_frame_equal (df , ref [:nrows ])
703752
@@ -731,11 +780,16 @@ def test_read_csv_names_not_accepting_sets(all_parsers):
731780 parser .read_csv (StringIO (data ), names = set ("QAZ" ))
732781
733782
734- @xfail_pyarrow
735783def test_read_table_delim_whitespace_default_sep (all_parsers ):
736784 # GH: 35958
737785 f = StringIO ("a b c\n 1 -2 -3\n 4 5 6" )
738786 parser = all_parsers
787+
788+ if parser .engine == "pyarrow" :
789+ msg = "The 'delim_whitespace' option is not supported with the 'pyarrow' engine"
790+ with pytest .raises (ValueError , match = msg ):
791+ parser .read_table (f , delim_whitespace = True )
792+ return
739793 result = parser .read_table (f , delim_whitespace = True )
740794 expected = DataFrame ({"a" : [1 , 4 ], "b" : [- 2 , 5 ], "c" : [- 3 , 6 ]})
741795 tm .assert_frame_equal (result , expected )
0 commit comments