Skip to content

Commit bae8d65

Browse files
update tests to avoid string[python_numpy]
1 parent ab96aa4 commit bae8d65

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/tests/series/test_constructors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,7 @@ def test_series_string_inference(self):
20772077
# GH#54430
20782078
with pd.option_context("future.infer_string", True):
20792079
ser = Series(["a", "b"])
2080-
dtype = "string[pyarrow_numpy]" if HAS_PYARROW else "string[python_numpy]"
2080+
dtype = pd.StringDtype("pyarrow" if HAS_PYARROW else "python", na_value=np.nan)
20812081
expected = Series(["a", "b"], dtype=dtype)
20822082
tm.assert_series_equal(ser, expected)
20832083

@@ -2091,23 +2091,23 @@ def test_series_string_with_na_inference(self, na_value):
20912091
# GH#54430
20922092
with pd.option_context("future.infer_string", True):
20932093
ser = Series(["a", na_value])
2094-
dtype = "string[pyarrow_numpy]" if HAS_PYARROW else "string[python_numpy]"
2094+
dtype = pd.StringDtype("pyarrow" if HAS_PYARROW else "python", na_value=np.nan)
20952095
expected = Series(["a", None], dtype=dtype)
20962096
tm.assert_series_equal(ser, expected)
20972097

20982098
def test_series_string_inference_scalar(self):
20992099
# GH#54430
21002100
with pd.option_context("future.infer_string", True):
21012101
ser = Series("a", index=[1])
2102-
dtype = "string[pyarrow_numpy]" if HAS_PYARROW else "string[python_numpy]"
2102+
dtype = pd.StringDtype("pyarrow" if HAS_PYARROW else "python", na_value=np.nan)
21032103
expected = Series("a", index=[1], dtype=dtype)
21042104
tm.assert_series_equal(ser, expected)
21052105

21062106
def test_series_string_inference_array_string_dtype(self):
21072107
# GH#54496
21082108
with pd.option_context("future.infer_string", True):
21092109
ser = Series(np.array(["a", "b"]))
2110-
dtype = "string[pyarrow_numpy]" if HAS_PYARROW else "string[python_numpy]"
2110+
dtype = pd.StringDtype("pyarrow" if HAS_PYARROW else "python", na_value=np.nan)
21112111
expected = Series(["a", "b"], dtype=dtype)
21122112
tm.assert_series_equal(ser, expected)
21132113

@@ -2134,7 +2134,7 @@ def test_series_string_inference_na_first(self):
21342134
# GH#55655
21352135
with pd.option_context("future.infer_string", True):
21362136
result = Series([pd.NA, "b"])
2137-
dtype = "string[pyarrow_numpy]" if HAS_PYARROW else "string[python_numpy]"
2137+
dtype = pd.StringDtype("pyarrow" if HAS_PYARROW else "python", na_value=np.nan)
21382138
expected = Series([None, "b"], dtype=dtype)
21392139
tm.assert_series_equal(result, expected)
21402140

0 commit comments

Comments
 (0)