Skip to content

Commit 2b67593

Browse files
authored
TST: de-xfail pyarrow dialect tests (#56040)
1 parent b2b27af commit 2b67593

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

pandas/tests/io/parser/test_dialect.py

+37-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
pytestmark = pytest.mark.filterwarnings(
1717
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
1818
)
19-
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
2019

2120

2221
@pytest.fixture
@@ -33,7 +32,6 @@ def custom_dialect():
3332
return dialect_name, dialect_kwargs
3433

3534

36-
@xfail_pyarrow # ValueError: The 'dialect' option is not supported
3735
def test_dialect(all_parsers):
3836
parser = all_parsers
3937
data = """\
@@ -44,6 +42,13 @@ def test_dialect(all_parsers):
4442

4543
dia = csv.excel()
4644
dia.quoting = csv.QUOTE_NONE
45+
46+
if parser.engine == "pyarrow":
47+
msg = "The 'dialect' option is not supported with the 'pyarrow' engine"
48+
with pytest.raises(ValueError, match=msg):
49+
parser.read_csv(StringIO(data), dialect=dia)
50+
return
51+
4752
df = parser.read_csv(StringIO(data), dialect=dia)
4853

4954
data = """\
@@ -56,7 +61,6 @@ def test_dialect(all_parsers):
5661
tm.assert_frame_equal(df, exp)
5762

5863

59-
@xfail_pyarrow # ValueError: The 'dialect' option is not supported
6064
def test_dialect_str(all_parsers):
6165
dialect_name = "mydialect"
6266
parser = all_parsers
@@ -68,6 +72,12 @@ def test_dialect_str(all_parsers):
6872
exp = DataFrame({"fruit": ["apple", "pear"], "vegetable": ["broccoli", "tomato"]})
6973

7074
with tm.with_csv_dialect(dialect_name, delimiter=":"):
75+
if parser.engine == "pyarrow":
76+
msg = "The 'dialect' option is not supported with the 'pyarrow' engine"
77+
with pytest.raises(ValueError, match=msg):
78+
parser.read_csv(StringIO(data), dialect=dialect_name)
79+
return
80+
7181
df = parser.read_csv(StringIO(data), dialect=dialect_name)
7282
tm.assert_frame_equal(df, exp)
7383

@@ -84,7 +94,6 @@ class InvalidDialect:
8494
parser.read_csv(StringIO(data), dialect=InvalidDialect)
8595

8696

87-
@xfail_pyarrow # ValueError: The 'dialect' option is not supported
8897
@pytest.mark.parametrize(
8998
"arg",
9099
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
@@ -114,6 +123,18 @@ def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, val
114123
kwds[arg] = "blah"
115124

116125
with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
126+
if parser.engine == "pyarrow":
127+
msg = "The 'dialect' option is not supported with the 'pyarrow' engine"
128+
with pytest.raises(ValueError, match=msg):
129+
parser.read_csv_check_warnings(
130+
# No warning bc we raise
131+
None,
132+
"Conflicting values for",
133+
StringIO(data),
134+
dialect=dialect_name,
135+
**kwds,
136+
)
137+
return
117138
result = parser.read_csv_check_warnings(
118139
warning_klass,
119140
"Conflicting values for",
@@ -124,7 +145,6 @@ def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, val
124145
tm.assert_frame_equal(result, expected)
125146

126147

127-
@xfail_pyarrow # ValueError: The 'dialect' option is not supported
128148
@pytest.mark.parametrize(
129149
"kwargs,warning_klass",
130150
[
@@ -153,6 +173,18 @@ def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning
153173
data = "a:b\n1:2"
154174

155175
with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
176+
if parser.engine == "pyarrow":
177+
msg = "The 'dialect' option is not supported with the 'pyarrow' engine"
178+
with pytest.raises(ValueError, match=msg):
179+
parser.read_csv_check_warnings(
180+
# no warning bc we raise
181+
None,
182+
"Conflicting values for 'delimiter'",
183+
StringIO(data),
184+
dialect=dialect_name,
185+
**kwargs,
186+
)
187+
return
156188
result = parser.read_csv_check_warnings(
157189
warning_klass,
158190
"Conflicting values for 'delimiter'",

0 commit comments

Comments
 (0)