From 5ce43b2ce9689600afd241185ca3ae7cc83d2aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Sat, 12 Jul 2025 13:58:15 -0400 Subject: [PATCH 1/3] GH1149 Add testing for pd.Series.str behavior --- tests/test_series.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_series.py b/tests/test_series.py index 7f51f9ad..104baf10 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -3975,3 +3975,11 @@ def test_timedelta_index_cumprod() -> None: if TYPE_CHECKING_INVALID_USAGE: assert_type(as_period_series.cumprod(), Never) + + +def test_series_str_upper() -> None: + """Test the returns of StringMethods match the type of the input series GH1149.""" + s_str = pd.Series(['a', 'b']) + check(assert_type(s_str, "pd.Series[str]"), pd.Series, str) + check(assert_type(s_str.str.upper(), "pd.Series[str]"), pd.Series, str) + check(assert_type(s_str.str.lower(), "pd.Series[str]"), pd.Series, str) From 2ec62ead479dd17219c875e920ee36d156342d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Sat, 12 Jul 2025 13:59:43 -0400 Subject: [PATCH 2/3] GH1149 run pre-commit --- tests/test_series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_series.py b/tests/test_series.py index 104baf10..4dd4653b 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -3979,7 +3979,7 @@ def test_timedelta_index_cumprod() -> None: def test_series_str_upper() -> None: """Test the returns of StringMethods match the type of the input series GH1149.""" - s_str = pd.Series(['a', 'b']) + s_str = pd.Series(["a", "b"]) check(assert_type(s_str, "pd.Series[str]"), pd.Series, str) check(assert_type(s_str.str.upper(), "pd.Series[str]"), pd.Series, str) check(assert_type(s_str.str.lower(), "pd.Series[str]"), pd.Series, str) From 3808b5c6eb3dc5e2d2ae355ea0c471bb9e399804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Sat, 12 Jul 2025 14:09:18 -0400 Subject: [PATCH 3/3] GH1149 modify test name --- tests/test_series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_series.py b/tests/test_series.py index 4dd4653b..1e48aae7 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -3977,7 +3977,7 @@ def test_timedelta_index_cumprod() -> None: assert_type(as_period_series.cumprod(), Never) -def test_series_str_upper() -> None: +def test_series_str_methods() -> None: """Test the returns of StringMethods match the type of the input series GH1149.""" s_str = pd.Series(["a", "b"]) check(assert_type(s_str, "pd.Series[str]"), pd.Series, str)