Skip to content

Commit 314442d

Browse files
authored
Change tests to support pandas 1.5.3 (#515)
* Modify tests that now work correctly with pandas 1.5.3 * fix nightly test * fix another nightly test * Add comment about nightly build issue
1 parent 2dfe36f commit 314442d

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pytest = ">=7.1.2"
4141
pyright = ">=1.1.286"
4242
poethepoet = ">=0.16.5"
4343
loguru = ">=0.6.0"
44-
pandas = "1.5.2"
44+
pandas = "1.5.3"
4545
numpy = ">=1.24.1"
4646
typing-extensions = ">=4.2.0"
4747
matplotlib = ">=3.5.1"

tests/test_frame.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import io
77
import itertools
88
from pathlib import Path
9-
import platform
109
from typing import (
1110
TYPE_CHECKING,
1211
Any,
@@ -2081,15 +2080,7 @@ class MyDataFrame(pd.DataFrame, Generic[T]):
20812080
def func() -> MyDataFrame[int]:
20822081
return MyDataFrame[int]({"foo": [1, 2, 3]})
20832082

2084-
# This should be fixed in pandas 1.5.2, if
2085-
# https://github.com/pandas-dev/pandas/pull/49736 is included
2086-
with pytest_warns_bounded(
2087-
UserWarning,
2088-
"Pandas doesn't allow columns to be created",
2089-
lower="3.10.99",
2090-
version_str=platform.python_version(),
2091-
):
2092-
func()
2083+
func()
20932084

20942085

20952086
def test_to_xarray():

tests/test_pandas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import pandas as pd
1414
from pandas import Grouper
1515
from pandas.api.extensions import ExtensionArray
16-
from pandas.util.version import Version
1716
import pytest
1817
from typing_extensions import assert_type
1918

@@ -1448,7 +1447,7 @@ def test_crosstab_args() -> None:
14481447
)
14491448
with pytest_warns_bounded(
14501449
FutureWarning,
1451-
"pivot_table dropped a column because",
1450+
r"The operation.*failed on a column",
14521451
upper="1.5.99",
14531452
upper_exception=TypeError,
14541453
):
@@ -1706,7 +1705,8 @@ def test_pivot_table() -> None:
17061705
),
17071706
pd.DataFrame,
17081707
)
1709-
if Version(np.__version__) <= Version("1.23.5"):
1708+
if PD_LTE_15:
1709+
# Nightly builds failing since 1/12/2023, but this is fixed since then
17101710
check(
17111711
assert_type(
17121712
pd.pivot_table(

0 commit comments

Comments
 (0)