Skip to content

Change tests to support pandas 1.5.3 #515

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 4 commits into from
Jan 20, 2023
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pytest = ">=7.1.2"
pyright = ">=1.1.286"
poethepoet = ">=0.16.5"
loguru = ">=0.6.0"
pandas = "1.5.2"
pandas = "1.5.3"
numpy = ">=1.24.1"
typing-extensions = ">=4.2.0"
matplotlib = ">=3.5.1"
Expand Down
11 changes: 1 addition & 10 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io
import itertools
from pathlib import Path
import platform
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -2081,15 +2080,7 @@ class MyDataFrame(pd.DataFrame, Generic[T]):
def func() -> MyDataFrame[int]:
return MyDataFrame[int]({"foo": [1, 2, 3]})

# This should be fixed in pandas 1.5.2, if
# https://github.com/pandas-dev/pandas/pull/49736 is included
with pytest_warns_bounded(
UserWarning,
"Pandas doesn't allow columns to be created",
lower="3.10.99",
version_str=platform.python_version(),
):
func()
func()


def test_to_xarray():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import pandas as pd
from pandas import Grouper
from pandas.api.extensions import ExtensionArray
from pandas.util.version import Version
import pytest
from typing_extensions import assert_type

Expand Down Expand Up @@ -1448,7 +1447,7 @@ def test_crosstab_args() -> None:
)
with pytest_warns_bounded(
FutureWarning,
"pivot_table dropped a column because",
r"The operation.*failed on a column",
upper="1.5.99",
upper_exception=TypeError,
):
Expand Down Expand Up @@ -1706,7 +1705,8 @@ def test_pivot_table() -> None:
),
pd.DataFrame,
)
if Version(np.__version__) <= Version("1.23.5"):
if PD_LTE_15:
# Nightly builds failing since 1/12/2023, but this is fixed since then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to double-check why we install a more than 7-day old pandas (not needed for now).

If we expect that the CI will pull in a newer version very soon, I wouldn't mind simply letting it fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to double-check why we install a more than 7-day old pandas (not needed for now).

If we expect that the CI will pull in a newer version very soon, I wouldn't mind simply letting it fail.

I put a message on slack and @lithomas1 said he'd look into it this weekend. I'd rather not let it fail to avoid getting the failure emails!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check(
assert_type(
pd.pivot_table(
Expand Down