Skip to content

Commit c444bfa

Browse files
move test to feather
1 parent 2f0272c commit c444bfa

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

pandas/tests/io/test_feather.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77
import pytest
88

9+
from pandas.compat.pyarrow import pa_version_under18p0
10+
911
import pandas as pd
1012
import pandas._testing as tm
1113

@@ -249,6 +251,23 @@ def test_string_inference(self, tmp_path):
249251
)
250252
tm.assert_frame_equal(result, expected)
251253

254+
@pytest.mark.skipif(pa_version_under18p0, reason="not supported before 18.0")
255+
def test_string_inference_string_view_type(self, tmp_path):
256+
# GH#54798
257+
import pyarrow as pa
258+
from pyarrow import feather
259+
260+
path = tmp_path / "string_view.parquet"
261+
table = pa.table({"a": pa.array([None, "b", "c"], pa.string_view())})
262+
feather.write_feather(table, path)
263+
264+
with pd.option_context("future.infer_string", True):
265+
result = read_feather(path)
266+
expected = pd.DataFrame(
267+
data={"a": [None, "b", "c"]}, dtype=pd.StringDtype(na_value=np.nan)
268+
)
269+
tm.assert_frame_equal(result, expected)
270+
252271
def test_out_of_bounds_datetime_to_feather(self):
253272
# GH#47832
254273
df = pd.DataFrame(

pandas/tests/io/test_parquet.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
pa_version_under13p0,
1818
pa_version_under15p0,
1919
pa_version_under17p0,
20-
pa_version_under18p0,
2120
)
2221

2322
import pandas as pd
@@ -1145,26 +1144,6 @@ def test_infer_string_large_string_type(self, tmp_path, pa):
11451144
)
11461145
tm.assert_frame_equal(result, expected)
11471146

1148-
@pytest.mark.skipif(pa_version_under18p0, reason="not supported before 18.0")
1149-
def test_infer_string_string_view_type(self, tmp_path, pa):
1150-
# GH#54798
1151-
import pyarrow as pa
1152-
import pyarrow.parquet as pq
1153-
1154-
path = tmp_path / "string_view.parquet"
1155-
1156-
table = pa.table({"a": pa.array([None, "b", "c"], pa.string_view())})
1157-
pq.write_table(table, path)
1158-
1159-
with pd.option_context("future.infer_string", True):
1160-
result = read_parquet(path)
1161-
expected = pd.DataFrame(
1162-
data={"a": [None, "b", "c"]},
1163-
dtype=pd.StringDtype(na_value=np.nan),
1164-
columns=pd.Index(["a"], dtype=pd.StringDtype(na_value=np.nan)),
1165-
)
1166-
tm.assert_frame_equal(result, expected)
1167-
11681147
# NOTE: this test is not run by default, because it requires a lot of memory (>5GB)
11691148
# @pytest.mark.slow
11701149
# def test_string_column_above_2GB(self, tmp_path, pa):

0 commit comments

Comments
 (0)