Skip to content

Commit 8f0c4d2

Browse files
authored
TST: de-xfail pyarrow parser tests (#56056)
* TST: un-xfail pyarrow thousands test * TST: de-xfail memory_map tests * remove unused * revert no-longer-needed
1 parent 6833344 commit 8f0c4d2

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

pandas/tests/io/parser/test_encoding.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
2424
)
2525

26-
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
2726
skip_pyarrow = pytest.mark.usefixtures("pyarrow_skip")
2827

2928

@@ -238,7 +237,6 @@ def test_parse_encoded_special_characters(encoding):
238237
tm.assert_frame_equal(result, expected)
239238

240239

241-
@xfail_pyarrow # ValueError: The 'memory_map' option is not supported
242240
@pytest.mark.parametrize("encoding", ["utf-8", None, "utf-16", "cp1255", "latin-1"])
243241
def test_encoding_memory_map(all_parsers, encoding):
244242
# GH40986
@@ -252,11 +250,17 @@ def test_encoding_memory_map(all_parsers, encoding):
252250
)
253251
with tm.ensure_clean() as file:
254252
expected.to_csv(file, index=False, encoding=encoding)
253+
254+
if parser.engine == "pyarrow":
255+
msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
256+
with pytest.raises(ValueError, match=msg):
257+
parser.read_csv(file, encoding=encoding, memory_map=True)
258+
return
259+
255260
df = parser.read_csv(file, encoding=encoding, memory_map=True)
256261
tm.assert_frame_equal(df, expected)
257262

258263

259-
@xfail_pyarrow # ValueError: The 'memory_map' option is not supported
260264
def test_chunk_splits_multibyte_char(all_parsers):
261265
"""
262266
Chunk splits a multibyte character with memory_map=True
@@ -272,11 +276,17 @@ def test_chunk_splits_multibyte_char(all_parsers):
272276
df.iloc[2047] = "a" * 127 + "ą"
273277
with tm.ensure_clean("bug-gh43540.csv") as fname:
274278
df.to_csv(fname, index=False, header=False, encoding="utf-8")
275-
dfr = parser.read_csv(fname, header=None, memory_map=True, engine="c")
279+
280+
if parser.engine == "pyarrow":
281+
msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
282+
with pytest.raises(ValueError, match=msg):
283+
parser.read_csv(fname, header=None, memory_map=True)
284+
return
285+
286+
dfr = parser.read_csv(fname, header=None, memory_map=True)
276287
tm.assert_frame_equal(dfr, df)
277288

278289

279-
@xfail_pyarrow # ValueError: The 'memory_map' option is not supported
280290
def test_readcsv_memmap_utf8(all_parsers):
281291
"""
282292
GH 43787
@@ -300,9 +310,14 @@ def test_readcsv_memmap_utf8(all_parsers):
300310
df = DataFrame(lines)
301311
with tm.ensure_clean("utf8test.csv") as fname:
302312
df.to_csv(fname, index=False, header=False, encoding="utf-8")
303-
dfr = parser.read_csv(
304-
fname, header=None, memory_map=True, engine="c", encoding="utf-8"
305-
)
313+
314+
if parser.engine == "pyarrow":
315+
msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
316+
with pytest.raises(ValueError, match=msg):
317+
parser.read_csv(fname, header=None, memory_map=True, encoding="utf-8")
318+
return
319+
320+
dfr = parser.read_csv(fname, header=None, memory_map=True, encoding="utf-8")
306321
tm.assert_frame_equal(df, dfr)
307322

308323

pandas/tests/io/parser/test_parse_dates.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,8 +1979,6 @@ def test_date_parser_multiindex_columns_combine_cols(all_parsers, parse_spec, co
19791979
tm.assert_frame_equal(result, expected)
19801980

19811981

1982-
# ValueError: The 'thousands' option is not supported with the 'pyarrow' engine
1983-
@xfail_pyarrow
19841982
def test_date_parser_usecols_thousands(all_parsers):
19851983
# GH#39365
19861984
data = """A,B,C
@@ -1989,12 +1987,21 @@ def test_date_parser_usecols_thousands(all_parsers):
19891987
"""
19901988

19911989
parser = all_parsers
1992-
warn = UserWarning
1990+
19931991
if parser.engine == "pyarrow":
19941992
# DeprecationWarning for passing a Manager object
1995-
warn = (UserWarning, DeprecationWarning)
1993+
msg = "The 'thousands' option is not supported with the 'pyarrow' engine"
1994+
with pytest.raises(ValueError, match=msg):
1995+
parser.read_csv(
1996+
StringIO(data),
1997+
parse_dates=[1],
1998+
usecols=[1, 2],
1999+
thousands="-",
2000+
)
2001+
return
2002+
19962003
result = parser.read_csv_check_warnings(
1997-
warn,
2004+
UserWarning,
19982005
"Could not infer format",
19992006
StringIO(data),
20002007
parse_dates=[1],

0 commit comments

Comments
 (0)