Skip to content

Commit fc066f4

Browse files
committed
Adjust test_string_inference for using_infer_string
1 parent 335fe18 commit fc066f4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pandas/tests/io/test_parquet.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,19 +1110,24 @@ def test_df_attrs_persistence(self, tmp_path, pa):
11101110
new_df = read_parquet(path, engine=pa)
11111111
assert new_df.attrs == df.attrs
11121112

1113-
def test_string_inference(self, tmp_path, pa):
1113+
def test_string_inference(self, tmp_path, pa, using_infer_string):
11141114
# GH#54431
11151115
path = tmp_path / "test_string_inference.p"
11161116
df = pd.DataFrame(data={"a": ["x", "y"]}, index=["a", "b"])
1117-
df.to_parquet(path, engine="pyarrow")
1117+
df.to_parquet(path, engine=pa)
11181118
with pd.option_context("future.infer_string", True):
11191119
result = read_parquet(path, engine="pyarrow")
11201120
dtype = pd.StringDtype(na_value=np.nan)
11211121
expected = pd.DataFrame(
11221122
data={"a": ["x", "y"]},
11231123
dtype=dtype,
11241124
index=pd.Index(["a", "b"], dtype=dtype),
1125-
columns=pd.Index(["a"], dtype=object if pa_version_under19p0 else dtype),
1125+
columns=pd.Index(
1126+
["a"],
1127+
dtype=object
1128+
if pa_version_under19p0 and not using_infer_string
1129+
else dtype,
1130+
),
11261131
)
11271132
tm.assert_frame_equal(result, expected)
11281133

0 commit comments

Comments
 (0)