Skip to content

Commit 3dc62dd

Browse files
authored
Remove deprecated behaviors (#268)
* Remove more deprecations * merge cleanup
1 parent 1293443 commit 3dc62dd

File tree

6 files changed

+28
-18
lines changed

6 files changed

+28
-18
lines changed

pandas-stubs/_testing/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def assert_series_equal(
6060
check_dtype: bool = ...,
6161
check_index_type: bool | str = ...,
6262
check_series_type: bool = ...,
63-
check_less_precise: bool | int = ...,
6463
check_names: bool = ...,
6564
check_exact: bool = ...,
6665
check_datetimelike_compat: bool = ...,

pandas-stubs/core/frame.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,9 +1428,7 @@ class DataFrame(NDFrame, OpsMixin):
14281428
ignore_na: _bool = ...,
14291429
axis: AxisType = ...,
14301430
) -> DataFrame: ...
1431-
def expanding(
1432-
self, min_periods: int = ..., center: _bool = ..., axis: AxisType = ...
1433-
): ... # for now
1431+
def expanding(self, min_periods: int = ..., axis: AxisType = ...): ... # for now
14341432
@overload
14351433
def ffill(
14361434
self,

pandas-stubs/core/series.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,30 +525,31 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
525525
@overload
526526
def sort_values(
527527
self,
528+
*,
528529
axis: AxisType = ...,
529530
ascending: _bool | Sequence[_bool] = ...,
530531
kind: SortKind = ...,
531532
na_position: NaPosition = ...,
532533
ignore_index: _bool = ...,
533-
*,
534534
inplace: Literal[True],
535535
key: Callable | None = ...,
536536
) -> None: ...
537537
@overload
538538
def sort_values(
539539
self,
540+
*,
540541
axis: AxisType = ...,
541542
ascending: _bool | Sequence[_bool] = ...,
542543
kind: SortKind = ...,
543544
na_position: NaPosition = ...,
544545
ignore_index: _bool = ...,
545-
*,
546546
inplace: Literal[False] = ...,
547547
key: Callable | None = ...,
548548
) -> Series[S1]: ...
549549
@overload
550550
def sort_values(
551551
self,
552+
*,
552553
axis: AxisType = ...,
553554
ascending: _bool | Sequence[_bool] = ...,
554555
inplace: _bool | None = ...,
@@ -1325,7 +1326,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
13251326
axis: SeriesAxisType = ...,
13261327
) -> ExponentialMovingWindow: ...
13271328
def expanding(
1328-
self, min_periods: int = ..., center: _bool = ..., axis: SeriesAxisType = ...
1329+
self, min_periods: int = ..., axis: SeriesAxisType = ...
13291330
) -> DataFrame: ...
13301331
def floordiv(
13311332
self,

tests/test_frame.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
from pandas._typing import Scalar
3535

36-
from tests import check
36+
from tests import (
37+
TYPE_CHECKING_INVALID_USAGE,
38+
check,
39+
)
3740

3841
from pandas.io.parsers import TextFileReader
3942

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

720724
df.rolling(2)
721725
df.rolling(2, axis=1, center=True)

tests/test_series.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ def test_types_sort_index_with_key() -> None:
227227
def test_types_sort_values() -> None:
228228
s = pd.Series([4, 2, 1, 3])
229229
check(assert_type(s.sort_values(), pd.Series), pd.Series)
230-
with pytest.warns(FutureWarning, match="In a future version of pandas"):
231-
check(assert_type(s.sort_values(0), pd.Series), pd.Series)
230+
if TYPE_CHECKING_INVALID_USAGE:
231+
check(assert_type(s.sort_values(0), pd.Series), pd.Series) # type: ignore[assert-type,call-overload]
232+
check(assert_type(s.sort_values(axis=0), pd.Series), pd.Series)
232233
check(assert_type(s.sort_values(ascending=False), pd.Series), pd.Series)
233234
assert assert_type(s.sort_values(inplace=True, kind="quicksort"), None) is None
234235
check(assert_type(s.sort_values(na_position="last"), pd.Series), pd.Series)
@@ -491,8 +492,9 @@ def test_types_plot() -> None:
491492
def test_types_window() -> None:
492493
s = pd.Series([0, 1, 1, 0, 5, 1, -10])
493494
s.expanding()
494-
with pytest.warns(FutureWarning, match="The `center` argument"):
495-
s.expanding(axis=0, center=True)
495+
s.expanding(axis=0)
496+
if TYPE_CHECKING_INVALID_USAGE:
497+
s.expanding(axis=0, center=True) # type: ignore[call-arg]
496498

497499
s.rolling(2)
498500
s.rolling(2, axis=0, center=True)

tests/test_testing.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
assert_frame_equal,
99
assert_series_equal,
1010
)
11-
import pytest
1211
from typing_extensions import assert_type
1312

14-
from tests import check
13+
from tests import (
14+
TYPE_CHECKING_INVALID_USAGE,
15+
check,
16+
)
1517

1618

1719
def test_types_assert_series_equal() -> None:
@@ -26,9 +28,13 @@ def test_types_assert_series_equal() -> None:
2628
check_flags=True,
2729
check_datetimelike_compat=True,
2830
)
29-
with pytest.warns(FutureWarning, match="The 'check_less_precise'"):
31+
if TYPE_CHECKING_INVALID_USAGE:
3032
assert_series_equal(
31-
s1, s2, check_dtype=True, check_less_precise=True, check_names=True
33+
s1,
34+
s2,
35+
check_dtype=True,
36+
check_less_precise=True, # type: ignore[call-arg]
37+
check_names=True,
3238
)
3339

3440

0 commit comments

Comments
 (0)