Skip to content

fix nightly runs #1289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ numpy = ">= 1.23.5"

[tool.poetry.group.dev.dependencies]
mypy = "1.17.0"
pandas = "2.3.0"
pandas = "2.3.1"
pyarrow = ">=10.0.1"
pytest = ">=7.1.2"
pyright = ">=1.1.400"
Expand Down
20 changes: 15 additions & 5 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2949,7 +2949,10 @@ def test_dataframe_replace() -> None:
check(assert_type(df.replace(regex=pattern, value="x"), pd.DataFrame), pd.DataFrame)

check(assert_type(df.replace(["a"], ["x"]), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace([pattern], ["x"]), pd.DataFrame), pd.DataFrame)
check(
assert_type(df.replace([pattern], ["x"], regex=True), pd.DataFrame),
pd.DataFrame,
)
check(assert_type(df.replace(regex=["a"], value=["x"]), pd.DataFrame), pd.DataFrame)
check(
assert_type(df.replace(regex=[pattern], value=["x"]), pd.DataFrame),
Expand All @@ -2958,7 +2961,9 @@ def test_dataframe_replace() -> None:

check(assert_type(df.replace({"a": "x"}), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace(replace_dict_scalar), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace({pattern: "x"}), pd.DataFrame), pd.DataFrame)
check(
assert_type(df.replace({pattern: "x"}, regex=True), pd.DataFrame), pd.DataFrame
)
check(assert_type(df.replace(pd.Series({"a": "x"})), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace(regex={"a": "x"}), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace(regex={pattern: "x"}), pd.DataFrame), pd.DataFrame)
Expand Down Expand Up @@ -3003,7 +3008,9 @@ def test_dataframe_replace() -> None:
pd.DataFrame,
)
check(
assert_type(df.replace({"col1": [pattern]}, {"col1": ["x"]}), pd.DataFrame),
assert_type(
df.replace({"col1": [pattern]}, {"col1": ["x"]}, regex=True), pd.DataFrame
),
pd.DataFrame,
)
check(
Expand Down Expand Up @@ -3037,7 +3044,10 @@ def test_dataframe_replace() -> None:

check(assert_type(df.replace({"col1": {"a": "x"}}), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace(replace_dict_per_column), pd.DataFrame), pd.DataFrame)
check(assert_type(df.replace({"col1": {pattern: "x"}}), pd.DataFrame), pd.DataFrame)
check(
assert_type(df.replace({"col1": {pattern: "x"}}, regex=True), pd.DataFrame),
pd.DataFrame,
)
check(
assert_type(df.replace({"col1": pd.Series({"a": "x"})}), pd.DataFrame),
pd.DataFrame,
Expand Down Expand Up @@ -3168,7 +3178,7 @@ def test_frame_reindex_like() -> None:
with pytest_warns_bounded(
FutureWarning,
"the 'method' keyword is deprecated and will be removed in a future version. Please take steps to stop the use of 'method'",
lower="2.3.0",
lower="2.3.99",
):
check(
assert_type(
Expand Down
18 changes: 14 additions & 4 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,14 @@ def test_types_values() -> None:
assert_type(pd.Series([1, 2, 3]).values, Union[ExtensionArray, np.ndarray]),
np.ndarray,
)
valresult_type: type[np.ndarray | ExtensionArray]
if PD_LTE_23:
valresult_type = np.ndarray
else:
valresult_type = ExtensionArray
check(
assert_type(pd.Series(list("aabc")).values, Union[np.ndarray, ExtensionArray]),
np.ndarray,
valresult_type,
)
check(
assert_type(
Expand Down Expand Up @@ -1707,11 +1712,14 @@ def test_series_replace() -> None:
pd.Series,
)
check(
assert_type(s.replace({pattern: "z"}), "pd.Series[str]"),
assert_type(s.replace({pattern: "z"}, regex=True), "pd.Series[str]"),
pd.Series,
)
check(assert_type(s.replace(["a"], ["x"]), "pd.Series[str]"), pd.Series)
check(assert_type(s.replace([pattern], ["x"]), "pd.Series[str]"), pd.Series)
check(
assert_type(s.replace([pattern], ["x"], regex=True), "pd.Series[str]"),
pd.Series,
)
check(assert_type(s.replace(r"^a.*", "x", regex=True), "pd.Series[str]"), pd.Series)
check(assert_type(s.replace(value="x", regex=r"^a.*"), "pd.Series[str]"), pd.Series)
check(
Expand Down Expand Up @@ -3793,7 +3801,9 @@ def test_path_div() -> None:
# GH 682
folder = Path.cwd()
files = pd.Series(["a.png", "b.png"])
check(assert_type(folder / files, pd.Series), pd.Series, Path)
if PD_LTE_23:
# Bug in 3.0 https://github.com/pandas-dev/pandas/issues/61940
check(assert_type(folder / files, pd.Series), pd.Series, Path)

folders = pd.Series([folder, folder])
check(assert_type(folders / Path("a.png"), pd.Series), pd.Series, Path)
Expand Down
21 changes: 15 additions & 6 deletions tests/test_string_accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing_extensions import assert_type

from tests import (
PD_LTE_23,
check,
np_ndarray_bool,
)
Expand Down Expand Up @@ -38,9 +39,13 @@ def test_string_accessors_boolean_series():
_check(
assert_type(s.str.contains("a"), "pd.Series[bool]"),
)
_check(
assert_type(s.str.contains(re.compile(r"a")), "pd.Series[bool]"),
)
if PD_LTE_23:
# Bug in pandas 3.0 dev https://github.com/pandas-dev/pandas/issues/61942
_check(
assert_type(
s.str.contains(re.compile(r"a"), regex=True), "pd.Series[bool]"
),
)
_check(assert_type(s.str.endswith("e"), "pd.Series[bool]"))
_check(assert_type(s.str.endswith(("e", "f")), "pd.Series[bool]"))
_check(assert_type(s.str.fullmatch("apple"), "pd.Series[bool]"))
Expand All @@ -66,9 +71,13 @@ def test_string_accessors_boolean_index():
_check(
assert_type(idx.str.contains("a"), np_ndarray_bool),
)
_check(
assert_type(idx.str.contains(re.compile(r"a")), np_ndarray_bool),
)
if PD_LTE_23:
# Bug in pandas 3.0 dev https://github.com/pandas-dev/pandas/issues/61942
_check(
assert_type(
idx.str.contains(re.compile(r"a"), regex=True), np_ndarray_bool
),
)
_check(assert_type(idx.str.endswith("e"), np_ndarray_bool))
_check(assert_type(idx.str.endswith(("e", "f")), np_ndarray_bool))
_check(assert_type(idx.str.fullmatch("apple"), np_ndarray_bool))
Expand Down
Loading