Skip to content

Commit e4e21b5

Browse files
committed
assert return type
1 parent e85659a commit e4e21b5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/test_series.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,19 @@ def test_types_sort_values_with_key() -> None:
417417

418418
def test_types_shift() -> None:
419419
s = pd.Series([1, 2, 3], index=pd.date_range("2020", periods=3))
420-
s.shift()
421-
s.shift(axis=0, periods=1)
422-
s.shift(-1, fill_value=0)
423-
s.shift(freq="1D")
420+
# Return type "Series[int]"" not quite correct
421+
# - https://github.com/pandas-dev/pandas-stubs/issues/1111
422+
# - https://github.com/pandas-dev/pandas-stubs/issues/1110
423+
check(assert_type(s.shift(), "pd.Series[int]"), pd.Series, np.floating)
424+
check(
425+
assert_type(s.shift(axis=0, periods=1), "pd.Series[int]"),
426+
pd.Series,
427+
np.floating,
428+
)
429+
check(
430+
assert_type(s.shift(-1, fill_value=0), "pd.Series[int]"), pd.Series, np.integer
431+
)
432+
check(assert_type(s.shift(freq="1D"), "pd.Series[int]"), pd.Series, np.integer)
424433

425434

426435
def test_types_rank() -> None:

0 commit comments

Comments
 (0)