Skip to content

CI: fix nightly #869

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 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 0 additions & 10 deletions pandas-stubs/io/formats/style.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,6 @@ class Styler(StylerRenderer):
level: Level | list[Level] | None = ...,
**kwargs: Any,
) -> Styler: ...
def applymap_index(
self,
func: Callable[[Scalar], str],
axis: Axis = ...,
level: Level | list[Level] | None = ...,
**kwargs: Any,
) -> Styler: ...
def applymap(
self, func: Callable[[Scalar], str], subset: Subset | None = ..., **kwargs: Any
) -> Styler: ...
def set_table_attributes(self, attributes: str) -> Styler: ...
def export(self) -> StyleExportDict: ...
def use(self, styles: StyleExportDict) -> Styler: ...
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

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


def check(actual: T, klass: type, dtype: type | None = None, attr: str = "left") -> T:
Expand Down
15 changes: 10 additions & 5 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from pandas import errors
import pytest

from tests import WINDOWS
from tests import (
PD_LTE_22,
WINDOWS,
)


def test_abstract_method_error() -> None:
Expand Down Expand Up @@ -105,13 +108,15 @@ def test_specification_error() -> None:


def test_setting_with_copy_error() -> None:
with pytest.raises(errors.SettingWithCopyError):
raise errors.SettingWithCopyError()
if PD_LTE_22:
with pytest.raises(errors.SettingWithCopyError):
raise errors.SettingWithCopyError()


def test_setting_with_copy_warning() -> None:
with pytest.warns(errors.SettingWithCopyWarning):
warnings.warn("", errors.SettingWithCopyWarning)
if PD_LTE_22:
with pytest.warns(errors.SettingWithCopyWarning):
warnings.warn("", errors.SettingWithCopyWarning)


def test_numexpr_clobbering_error() -> None:
Expand Down
9 changes: 7 additions & 2 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from pandas._typing import Scalar

from tests import (
PD_LTE_22,
TYPE_CHECKING_INVALID_USAGE,
check,
pytest_warns_bounded,
Expand Down Expand Up @@ -2257,7 +2258,11 @@ def test_groupby_result() -> None:
index, value = next(iterator)
assert_type((index, value), tuple[tuple, pd.DataFrame])

check(assert_type(index, tuple), tuple, np.integer)
if PD_LTE_22:
check(assert_type(index, tuple), tuple, np.integer)
else:
check(assert_type(index, tuple), tuple, int)

check(assert_type(value, pd.DataFrame), pd.DataFrame)

iterator2 = df.groupby("a").__iter__()
Expand Down Expand Up @@ -2365,7 +2370,7 @@ def test_groupby_result_for_ambiguous_indexes() -> None:
with pytest_warns_bounded(
FutureWarning,
"The default of observed=False is deprecated",
lower="2.0.99",
upper="2.2.99",
):
categorical_index = pd.CategoricalIndex(df.a)
iterator2 = df.groupby(categorical_index).__iter__()
Expand Down
Loading