Skip to content

Commit db38017

Browse files
TST (string dtype): resolve xfail in arrow interface tests (#60241)
1 parent 9b16b9e commit db38017

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pandas/tests/frame/test_arrow_interface.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22

33
import pytest
44

5-
from pandas._config import using_string_dtype
6-
75
import pandas.util._test_decorators as td
86

97
import pandas as pd
108

119
pa = pytest.importorskip("pyarrow")
1210

1311

14-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
1512
@td.skip_if_no("pyarrow", min_version="14.0")
16-
def test_dataframe_arrow_interface():
13+
def test_dataframe_arrow_interface(using_infer_string):
1714
df = pd.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]})
1815

1916
capsule = df.__arrow_c_stream__()
@@ -25,7 +22,8 @@ def test_dataframe_arrow_interface():
2522
)
2623

2724
table = pa.table(df)
28-
expected = pa.table({"a": [1, 2, 3], "b": ["a", "b", "c"]})
25+
string_type = pa.large_string() if using_infer_string else pa.string()
26+
expected = pa.table({"a": [1, 2, 3], "b": pa.array(["a", "b", "c"], string_type)})
2927
assert table.equals(expected)
3028

3129
schema = pa.schema([("a", pa.int8()), ("b", pa.string())])
@@ -34,13 +32,13 @@ def test_dataframe_arrow_interface():
3432
assert table.equals(expected)
3533

3634

37-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
3835
@td.skip_if_no("pyarrow", min_version="15.0")
39-
def test_dataframe_to_arrow():
36+
def test_dataframe_to_arrow(using_infer_string):
4037
df = pd.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]})
4138

4239
table = pa.RecordBatchReader.from_stream(df).read_all()
43-
expected = pa.table({"a": [1, 2, 3], "b": ["a", "b", "c"]})
40+
string_type = pa.large_string() if using_infer_string else pa.string()
41+
expected = pa.table({"a": [1, 2, 3], "b": pa.array(["a", "b", "c"], string_type)})
4442
assert table.equals(expected)
4543

4644
schema = pa.schema([("a", pa.int8()), ("b", pa.string())])

0 commit comments

Comments
 (0)