Skip to content

Commit 30c41f3

Browse files
fix using_infer_string
1 parent af81bb1 commit 30c41f3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pandas/tests/arrays/string_/test_string.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,10 @@ def test_arrow_roundtrip(dtype, string_storage, using_infer_string):
541541
else:
542542
assert isinstance(result["a"].dtype, pd.StringDtype)
543543
expected = df.astype(pd.StringDtype(string_storage, na_value=dtype.na_value))
544-
expected.columns = expected.columns.astype(
545-
pd.StringDtype(string_storage, na_value=np.nan)
546-
)
544+
if using_infer_string:
545+
expected.columns = expected.columns.astype(
546+
pd.StringDtype(string_storage, na_value=np.nan)
547+
)
547548
tm.assert_frame_equal(result, expected)
548549
# ensure the missing value is represented by NA and not np.nan or None
549550
assert result.loc[2, "a"] is result["a"].dtype.na_value
@@ -571,9 +572,10 @@ def test_arrow_load_from_zero_chunks(dtype, string_storage, using_infer_string):
571572
else:
572573
assert isinstance(result["a"].dtype, pd.StringDtype)
573574
expected = df.astype(pd.StringDtype(string_storage, na_value=dtype.na_value))
574-
expected.columns = expected.columns.astype(
575-
pd.StringDtype(string_storage, na_value=np.nan)
576-
)
575+
if using_infer_string:
576+
expected.columns = expected.columns.astype(
577+
pd.StringDtype(string_storage, na_value=np.nan)
578+
)
577579
tm.assert_frame_equal(result, expected)
578580

579581

0 commit comments

Comments
 (0)