Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST (string dtype): resolve xfail in arrow interface tests #60241

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions pandas/tests/frame/test_arrow_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import pytest

from pandas._config import using_string_dtype

import pandas.util._test_decorators as td

import pandas as pd

pa = pytest.importorskip("pyarrow")


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

capsule = df.__arrow_c_stream__()
Expand All @@ -25,7 +22,8 @@ def test_dataframe_arrow_interface():
)

table = pa.table(df)
expected = pa.table({"a": [1, 2, 3], "b": ["a", "b", "c"]})
string_type = pa.large_string() if using_infer_string else pa.string()
expected = pa.table({"a": [1, 2, 3], "b": pa.array(["a", "b", "c"], string_type)})
assert table.equals(expected)

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


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

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

schema = pa.schema([("a", pa.int8()), ("b", pa.string())])
Expand Down
Loading