Skip to content

Commit 23b35e4

Browse files
authored
CI: fix nightly (#869)
* CI: fix nightly * remove ignores and address comment
1 parent a51279e commit 23b35e4

15 files changed

+297
-343
lines changed

pandas-stubs/_typing.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ SequenceIndexer: TypeAlias = slice | list[int] | np.ndarray
581581
PositionalIndexer: TypeAlias = ScalarIndexer | SequenceIndexer
582582
TakeIndexer: TypeAlias = Sequence[int] | Sequence[np.integer] | npt.NDArray[np.integer]
583583

584-
IgnoreRaiseCoerce: TypeAlias = Literal["ignore", "raise", "coerce"]
584+
RaiseCoerce: TypeAlias = Literal["raise", "coerce"]
585585

586586
# Shared by functions such as drop and astype
587587
IgnoreRaise: TypeAlias = Literal["ignore", "raise"]

pandas-stubs/core/tools/datetimes.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ from pandas._typing import (
2626
AnyArrayLike,
2727
DictConvertible,
2828
IgnoreRaise,
29-
IgnoreRaiseCoerce,
29+
RaiseCoerce,
3030
TimestampConvertibleTypes,
3131
npt,
3232
)
@@ -68,7 +68,7 @@ def to_datetime(
6868
@overload
6969
def to_datetime(
7070
arg: Series | DictConvertible,
71-
errors: IgnoreRaiseCoerce = ...,
71+
errors: RaiseCoerce = ...,
7272
dayfirst: bool = ...,
7373
yearfirst: bool = ...,
7474
utc: bool = ...,
@@ -91,7 +91,7 @@ def to_datetime(
9191
| Index
9292
| ExtensionArray
9393
),
94-
errors: IgnoreRaiseCoerce = ...,
94+
errors: RaiseCoerce = ...,
9595
dayfirst: bool = ...,
9696
yearfirst: bool = ...,
9797
utc: bool = ...,

pandas-stubs/core/tools/numeric.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from typing_extensions import TypeAlias
1010
from pandas._libs.lib import NoDefault
1111
from pandas._typing import (
1212
DtypeBackend,
13-
IgnoreRaiseCoerce,
13+
RaiseCoerce,
1414
Scalar,
1515
npt,
1616
)
@@ -27,14 +27,14 @@ def to_numeric(
2727
@overload
2828
def to_numeric(
2929
arg: list | tuple | np.ndarray,
30-
errors: IgnoreRaiseCoerce = ...,
30+
errors: RaiseCoerce = ...,
3131
downcast: _Downcast = ...,
3232
dtype_backend: DtypeBackend | NoDefault = ...,
3333
) -> npt.NDArray: ...
3434
@overload
3535
def to_numeric(
3636
arg: pd.Series,
37-
errors: IgnoreRaiseCoerce = ...,
37+
errors: RaiseCoerce = ...,
3838
downcast: _Downcast = ...,
3939
dtype_backend: DtypeBackend | NoDefault = ...,
4040
) -> pd.Series: ...

pandas-stubs/core/tools/timedeltas.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ from pandas._libs.tslibs import Timedelta
1313
from pandas._libs.tslibs.timedeltas import TimeDeltaUnitChoices
1414
from pandas._typing import (
1515
ArrayLike,
16-
IgnoreRaiseCoerce,
16+
RaiseCoerce,
1717
)
1818

1919
@overload
2020
def to_timedelta(
2121
arg: str | float | timedelta,
2222
unit: TimeDeltaUnitChoices | None = ...,
23-
errors: IgnoreRaiseCoerce = ...,
23+
errors: RaiseCoerce = ...,
2424
) -> Timedelta: ...
2525
@overload
2626
def to_timedelta(
2727
arg: Series,
2828
unit: TimeDeltaUnitChoices | None = ...,
29-
errors: IgnoreRaiseCoerce = ...,
29+
errors: RaiseCoerce = ...,
3030
) -> TimedeltaSeries: ...
3131
@overload
3232
def to_timedelta(
@@ -39,5 +39,5 @@ def to_timedelta(
3939
| Index
4040
),
4141
unit: TimeDeltaUnitChoices | None = ...,
42-
errors: IgnoreRaiseCoerce = ...,
42+
errors: RaiseCoerce = ...,
4343
) -> TimedeltaIndex: ...

pandas-stubs/io/formats/style.pyi

-10
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,6 @@ class Styler(StylerRenderer):
218218
level: Level | list[Level] | None = ...,
219219
**kwargs: Any,
220220
) -> Styler: ...
221-
def applymap_index(
222-
self,
223-
func: Callable[[Scalar], str],
224-
axis: Axis = ...,
225-
level: Level | list[Level] | None = ...,
226-
**kwargs: Any,
227-
) -> Styler: ...
228-
def applymap(
229-
self, func: Callable[[Scalar], str], subset: Subset | None = ..., **kwargs: Any
230-
) -> Styler: ...
231221
def set_table_attributes(self, attributes: str) -> Styler: ...
232222
def export(self) -> StyleExportDict: ...
233223
def use(self, styles: StyleExportDict) -> Styler: ...

tests/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
2323
WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
24-
PD_LTE_21 = Version(pd.__version__) < Version("2.1.999")
24+
PD_LTE_22 = Version(pd.__version__) < Version("2.2.999")
2525

2626

2727
def check(actual: T, klass: type, dtype: type | None = None, attr: str = "left") -> T:

tests/test_errors.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from pandas import errors
44
import pytest
55

6-
from tests import WINDOWS
6+
from tests import (
7+
PD_LTE_22,
8+
WINDOWS,
9+
)
710

811

912
def test_abstract_method_error() -> None:
@@ -105,13 +108,15 @@ def test_specification_error() -> None:
105108

106109

107110
def test_setting_with_copy_error() -> None:
108-
with pytest.raises(errors.SettingWithCopyError):
109-
raise errors.SettingWithCopyError()
111+
if PD_LTE_22:
112+
with pytest.raises(errors.SettingWithCopyError):
113+
raise errors.SettingWithCopyError()
110114

111115

112116
def test_setting_with_copy_warning() -> None:
113-
with pytest.warns(errors.SettingWithCopyWarning):
114-
warnings.warn("", errors.SettingWithCopyWarning)
117+
if PD_LTE_22:
118+
with pytest.warns(errors.SettingWithCopyWarning):
119+
warnings.warn("", errors.SettingWithCopyWarning)
115120

116121

117122
def test_numexpr_clobbering_error() -> None:

tests/test_frame.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from pandas._typing import Scalar
4646

4747
from tests import (
48+
PD_LTE_22,
4849
TYPE_CHECKING_INVALID_USAGE,
4950
check,
5051
pytest_warns_bounded,
@@ -2257,7 +2258,11 @@ def test_groupby_result() -> None:
22572258
index, value = next(iterator)
22582259
assert_type((index, value), tuple[tuple, pd.DataFrame])
22592260

2260-
check(assert_type(index, tuple), tuple, np.integer)
2261+
if PD_LTE_22:
2262+
check(assert_type(index, tuple), tuple, np.integer)
2263+
else:
2264+
check(assert_type(index, tuple), tuple, int)
2265+
22612266
check(assert_type(value, pd.DataFrame), pd.DataFrame)
22622267

22632268
iterator2 = df.groupby("a").__iter__()
@@ -2365,7 +2370,7 @@ def test_groupby_result_for_ambiguous_indexes() -> None:
23652370
with pytest_warns_bounded(
23662371
FutureWarning,
23672372
"The default of observed=False is deprecated",
2368-
lower="2.0.99",
2373+
upper="2.2.99",
23692374
):
23702375
categorical_index = pd.CategoricalIndex(df.a)
23712376
iterator2 = df.groupby(categorical_index).__iter__()

0 commit comments

Comments
 (0)