Skip to content

Commit 9a47508

Browse files
committed
use -> T so it matches other .str methods like .str.uppercase
1 parent 5edf982 commit 9a47508

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pandas-stubs/core/strings.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class StringMethods(NoNewAttributesMixin, Generic[T, _TS, _TM, _TS2]):
6868
sep: str = ...,
6969
na_rep: str | None = ...,
7070
join: JoinHow = ...,
71-
) -> Series[str]: ...
71+
) -> T: ...
7272
@overload
7373
def split(
7474
self, pat: str = ..., *, n: int = ..., expand: Literal[True], regex: bool = ...

tests/test_series.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,13 @@
6666
TimedeltaSeries,
6767
TimestampSeries,
6868
)
69+
70+
from pandas._typing import UnknownSeries
6971
else:
7072
TimedeltaSeries: TypeAlias = pd.Series
7173
TimestampSeries: TypeAlias = pd.Series
7274
OffsetSeries: TypeAlias = pd.Series
75+
UnknownSeries: TypeAlias = pd.Series
7376

7477
if TYPE_CHECKING:
7578
from pandas._typing import (
@@ -1667,18 +1670,16 @@ def test_series_overloads_cat():
16671670
check(assert_type(s.str.cat(None, sep=";"), str), str)
16681671
check(
16691672
assert_type(
1670-
s.str.cat(["A", "B", "C", "D", "E", "F", "G"], sep=";"), "pd.Series[str]"
1673+
s.str.cat(["A", "B", "C", "D", "E", "F", "G"], sep=";"), UnknownSeries
16711674
),
1672-
pd.Series,
1673-
str,
1675+
UnknownSeries,
16741676
)
16751677
check(
16761678
assert_type(
16771679
s.str.cat(pd.Series(["A", "B", "C", "D", "E", "F", "G"]), sep=";"),
1678-
"pd.Series[str]",
1680+
UnknownSeries,
16791681
),
1680-
pd.Series,
1681-
str,
1682+
UnknownSeries,
16821683
)
16831684

16841685

0 commit comments

Comments
 (0)