Skip to content

Commit c689ce6

Browse files
jbrockmendelphofl
authored andcommitted
TST: de-xfail pyarrow parser tests (pandas-dev#56071)
1 parent 8fb9ca9 commit c689ce6

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

pandas/tests/io/parser/common/test_common_basic.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,16 @@ def test_escapechar(all_parsers):
399399
tm.assert_index_equal(result.columns, Index(["SEARCH_TERM", "ACTUAL_URL"]))
400400

401401

402-
@xfail_pyarrow # ValueError: the 'pyarrow' engine does not support regex separators
403402
def test_ignore_leading_whitespace(all_parsers):
404403
# see gh-3374, gh-6607
405404
parser = all_parsers
406405
data = " a b c\n 1 2 3\n 4 5 6\n 7 8 9"
406+
407+
if parser.engine == "pyarrow":
408+
msg = "the 'pyarrow' engine does not support regex separators"
409+
with pytest.raises(ValueError, match=msg):
410+
parser.read_csv(StringIO(data), sep=r"\s+")
411+
return
407412
result = parser.read_csv(StringIO(data), sep=r"\s+")
408413

409414
expected = DataFrame({"a": [1, 4, 7], "b": [2, 5, 8], "c": [3, 6, 9]})
@@ -582,12 +587,14 @@ def test_empty_lines(all_parsers, sep, skip_blank_lines, exp_data, request):
582587

583588
if sep == r"\s+":
584589
data = data.replace(",", " ")
590+
585591
if parser.engine == "pyarrow":
586-
mark = pytest.mark.xfail(
587-
raises=ValueError,
588-
reason="the 'pyarrow' engine does not support regex separators",
589-
)
590-
request.applymarker(mark)
592+
msg = "the 'pyarrow' engine does not support regex separators"
593+
with pytest.raises(ValueError, match=msg):
594+
parser.read_csv(
595+
StringIO(data), sep=sep, skip_blank_lines=skip_blank_lines
596+
)
597+
return
591598

592599
result = parser.read_csv(StringIO(data), sep=sep, skip_blank_lines=skip_blank_lines)
593600
expected = DataFrame(exp_data, columns=["A", "B", "C"])
@@ -610,7 +617,6 @@ def test_whitespace_lines(all_parsers):
610617
tm.assert_frame_equal(result, expected)
611618

612619

613-
@xfail_pyarrow # ValueError: the 'pyarrow' engine does not support regex separators
614620
@pytest.mark.parametrize(
615621
"data,expected",
616622
[
@@ -635,6 +641,12 @@ def test_whitespace_lines(all_parsers):
635641
def test_whitespace_regex_separator(all_parsers, data, expected):
636642
# see gh-6607
637643
parser = all_parsers
644+
if parser.engine == "pyarrow":
645+
msg = "the 'pyarrow' engine does not support regex separators"
646+
with pytest.raises(ValueError, match=msg):
647+
parser.read_csv(StringIO(data), sep=r"\s+")
648+
return
649+
638650
result = parser.read_csv(StringIO(data), sep=r"\s+")
639651
tm.assert_frame_equal(result, expected)
640652

pandas/tests/io/parser/common/test_file_buffer_url.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ def test_eof_states(all_parsers, data, kwargs, expected, msg, request):
235235
tm.assert_frame_equal(result, expected)
236236

237237

238-
@xfail_pyarrow # ValueError: the 'pyarrow' engine does not support regex separators
239238
def test_temporary_file(all_parsers):
240239
# see gh-13398
241240
parser = all_parsers
@@ -246,6 +245,12 @@ def test_temporary_file(all_parsers):
246245
new_file.flush()
247246
new_file.seek(0)
248247

248+
if parser.engine == "pyarrow":
249+
msg = "the 'pyarrow' engine does not support regex separators"
250+
with pytest.raises(ValueError, match=msg):
251+
parser.read_csv(new_file, sep=r"\s+", header=None)
252+
return
253+
249254
result = parser.read_csv(new_file, sep=r"\s+", header=None)
250255

251256
expected = DataFrame([[0, 0]])

0 commit comments

Comments
 (0)