Skip to content

Remove deprecated behaviors #268

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 2 commits into from
Sep 5, 2022
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
1 change: 0 additions & 1 deletion pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def assert_series_equal(
check_dtype: bool = ...,
check_index_type: bool | str = ...,
check_series_type: bool = ...,
check_less_precise: bool | int = ...,
check_names: bool = ...,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
Expand Down
4 changes: 1 addition & 3 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,7 @@ class DataFrame(NDFrame, OpsMixin):
ignore_na: _bool = ...,
axis: AxisType = ...,
) -> DataFrame: ...
def expanding(
self, min_periods: int = ..., center: _bool = ..., axis: AxisType = ...
): ... # for now
def expanding(self, min_periods: int = ..., axis: AxisType = ...): ... # for now
@overload
def ffill(
self,
Expand Down
7 changes: 4 additions & 3 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -525,30 +525,31 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
@overload
def sort_values(
self,
*,
axis: AxisType = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
ignore_index: _bool = ...,
*,
inplace: Literal[True],
key: Callable | None = ...,
) -> None: ...
@overload
def sort_values(
self,
*,
axis: AxisType = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
ignore_index: _bool = ...,
*,
inplace: Literal[False] = ...,
key: Callable | None = ...,
) -> Series[S1]: ...
@overload
def sort_values(
self,
*,
axis: AxisType = ...,
ascending: _bool | Sequence[_bool] = ...,
inplace: _bool | None = ...,
Expand Down Expand Up @@ -1325,7 +1326,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
axis: SeriesAxisType = ...,
) -> ExponentialMovingWindow: ...
def expanding(
self, min_periods: int = ..., center: _bool = ..., axis: SeriesAxisType = ...
self, min_periods: int = ..., axis: SeriesAxisType = ...
) -> DataFrame: ...
def floordiv(
self,
Expand Down
10 changes: 7 additions & 3 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@

from pandas._typing import Scalar

from tests import check
from tests import (
TYPE_CHECKING_INVALID_USAGE,
check,
)

from pandas.io.parsers import TextFileReader

Expand Down Expand Up @@ -714,8 +717,9 @@ def test_types_plot() -> None:
def test_types_window() -> None:
df = pd.DataFrame(data={"col1": [1, 1, 2], "col2": [3, 4, 5]})
df.expanding()
with pytest.warns(FutureWarning, match="The `center` argument on"):
df.expanding(axis=1, center=True)
df.expanding(axis=1)
if TYPE_CHECKING_INVALID_USAGE:
df.expanding(axis=1, center=True) # type: ignore[call-arg]

df.rolling(2)
df.rolling(2, axis=1, center=True)
Expand Down
10 changes: 6 additions & 4 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ def test_types_sort_index_with_key() -> None:
def test_types_sort_values() -> None:
s = pd.Series([4, 2, 1, 3])
check(assert_type(s.sort_values(), pd.Series), pd.Series)
with pytest.warns(FutureWarning, match="In a future version of pandas"):
check(assert_type(s.sort_values(0), pd.Series), pd.Series)
if TYPE_CHECKING_INVALID_USAGE:
check(assert_type(s.sort_values(0), pd.Series), pd.Series) # type: ignore[assert-type,call-overload]
check(assert_type(s.sort_values(axis=0), pd.Series), pd.Series)
check(assert_type(s.sort_values(ascending=False), pd.Series), pd.Series)
assert assert_type(s.sort_values(inplace=True, kind="quicksort"), None) is None
check(assert_type(s.sort_values(na_position="last"), pd.Series), pd.Series)
Expand Down Expand Up @@ -491,8 +492,9 @@ def test_types_plot() -> None:
def test_types_window() -> None:
s = pd.Series([0, 1, 1, 0, 5, 1, -10])
s.expanding()
with pytest.warns(FutureWarning, match="The `center` argument"):
s.expanding(axis=0, center=True)
s.expanding(axis=0)
if TYPE_CHECKING_INVALID_USAGE:
s.expanding(axis=0, center=True) # type: ignore[call-arg]

s.rolling(2)
s.rolling(2, axis=0, center=True)
Expand Down
14 changes: 10 additions & 4 deletions tests/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
assert_frame_equal,
assert_series_equal,
)
import pytest
from typing_extensions import assert_type

from tests import check
from tests import (
TYPE_CHECKING_INVALID_USAGE,
check,
)


def test_types_assert_series_equal() -> None:
Expand All @@ -26,9 +28,13 @@ def test_types_assert_series_equal() -> None:
check_flags=True,
check_datetimelike_compat=True,
)
with pytest.warns(FutureWarning, match="The 'check_less_precise'"):
if TYPE_CHECKING_INVALID_USAGE:
assert_series_equal(
s1, s2, check_dtype=True, check_less_precise=True, check_names=True
s1,
s2,
check_dtype=True,
check_less_precise=True, # type: ignore[call-arg]
check_names=True,
)


Expand Down