Skip to content

Commit 4f0f95d

Browse files
committed
Adapt test_get_handle_pyarrow_compat for pyarrow 19
1 parent ae79826 commit 4f0f95d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/tests/io/test_common.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import pandas as pd
2929
import pandas._testing as tm
30+
from pandas.util.version import Version
3031

3132
import pandas.io.common as icom
3233

@@ -139,6 +140,7 @@ def test_bytesiowrapper_returns_correct_bytes(self):
139140

140141
# Test that pyarrow can handle a file opened with get_handle
141142
def test_get_handle_pyarrow_compat(self):
143+
pa = pytest.importorskip("pyarrow")
142144
pa_csv = pytest.importorskip("pyarrow.csv")
143145

144146
# Test latin1, ucs-2, and ucs-4 chars
@@ -152,8 +154,8 @@ def test_get_handle_pyarrow_compat(self):
152154
s = StringIO(data)
153155
with icom.get_handle(s, "rb", is_text=False) as handles:
154156
df = pa_csv.read_csv(handles.handle).to_pandas()
155-
# TODO will have to update this when pyarrow' to_pandas() is fixed
156-
expected = expected.astype("object")
157+
if Version(pa.__version__) < Version("19.0"):
158+
expected = expected.astype("object")
157159
tm.assert_frame_equal(df, expected)
158160
assert not s.closed
159161

0 commit comments

Comments
 (0)