Skip to content

fix nightly tests to work with 2.1 dev code #742

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 1 commit into from
Jul 9, 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
89 changes: 54 additions & 35 deletions tests/test_api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

from pandas._typing import DtypeObj

from tests import check
from tests import (
check,
pytest_warns_bounded,
)

nparr = np.array([1, 2, 3])
arr = pd.Series([1, 2, 3])
Expand Down Expand Up @@ -52,12 +55,15 @@ def test_is_bool_dtype() -> None:


def test_is_categorical_dtype() -> None:
check(assert_type(api.is_categorical_dtype(arr), bool), bool)
check(assert_type(api.is_categorical_dtype(nparr), bool), bool)
check(assert_type(api.is_categorical_dtype(dtylike), bool), bool)
check(assert_type(api.is_categorical_dtype(dframe), bool), bool)
check(assert_type(api.is_categorical_dtype(ind), bool), bool)
check(assert_type(api.is_categorical_dtype(ExtensionDtype), bool), bool)
with pytest_warns_bounded(
FutureWarning, "is_categorical_dtype is deprecated", lower="2.0.99"
):
check(assert_type(api.is_categorical_dtype(arr), bool), bool)
check(assert_type(api.is_categorical_dtype(nparr), bool), bool)
check(assert_type(api.is_categorical_dtype(dtylike), bool), bool)
check(assert_type(api.is_categorical_dtype(dframe), bool), bool)
check(assert_type(api.is_categorical_dtype(ind), bool), bool)
check(assert_type(api.is_categorical_dtype(ExtensionDtype), bool), bool)


def test_is_complex() -> None:
Expand Down Expand Up @@ -121,12 +127,15 @@ def test_is_datetime64_ns_dtype() -> None:


def test_is_datetime64tz_dtype() -> None:
check(assert_type(api.is_datetime64tz_dtype(arr), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(nparr), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(dtylike), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(dframe), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(ind), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(ExtensionDtype), bool), bool)
with pytest_warns_bounded(
FutureWarning, "is_datetime64tz_dtype is deprecated", lower="2.0.99"
):
check(assert_type(api.is_datetime64tz_dtype(arr), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(nparr), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(dtylike), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(dframe), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(ind), bool), bool)
check(assert_type(api.is_datetime64tz_dtype(ExtensionDtype), bool), bool)


def test_is_dict_like() -> None:
Expand Down Expand Up @@ -203,12 +212,15 @@ def test_is_hashable() -> None:


def test_is_int64_dtype() -> None:
check(assert_type(api.is_int64_dtype(arr), bool), bool)
check(assert_type(api.is_int64_dtype(nparr), bool), bool)
check(assert_type(api.is_int64_dtype(dtylike), bool), bool)
check(assert_type(api.is_int64_dtype(dframe), bool), bool)
check(assert_type(api.is_int64_dtype(ind), bool), bool)
# check(assert_type(api.is_int64_dtype(ExtensionDtype), bool), bool) pandas GH 50923
with pytest_warns_bounded(
FutureWarning, "is_int64_dtype is deprecated", lower="2.0.99"
):
check(assert_type(api.is_int64_dtype(arr), bool), bool)
check(assert_type(api.is_int64_dtype(nparr), bool), bool)
check(assert_type(api.is_int64_dtype(dtylike), bool), bool)
check(assert_type(api.is_int64_dtype(dframe), bool), bool)
check(assert_type(api.is_int64_dtype(ind), bool), bool)
# check(assert_type(api.is_int64_dtype(ExtensionDtype), bool), bool) pandas GH 50923


def test_is_integer() -> None:
Expand Down Expand Up @@ -248,13 +260,16 @@ def test_is_interval() -> None:


def test_is_interval_dtype() -> None:
check(assert_type(api.is_interval_dtype(obj), bool), bool)
check(assert_type(api.is_interval_dtype(nparr), bool), bool)
check(assert_type(api.is_interval_dtype(dtylike), bool), bool)
check(assert_type(api.is_interval_dtype(arr), bool), bool)
check(assert_type(api.is_interval_dtype(dframe), bool), bool)
check(assert_type(api.is_interval_dtype(ind), bool), bool)
check(assert_type(api.is_interval_dtype(ExtensionDtype), bool), bool)
with pytest_warns_bounded(
FutureWarning, "is_interval_dtype is deprecated", lower="2.0.99"
):
check(assert_type(api.is_interval_dtype(obj), bool), bool)
check(assert_type(api.is_interval_dtype(nparr), bool), bool)
check(assert_type(api.is_interval_dtype(dtylike), bool), bool)
check(assert_type(api.is_interval_dtype(arr), bool), bool)
check(assert_type(api.is_interval_dtype(dframe), bool), bool)
check(assert_type(api.is_interval_dtype(ind), bool), bool)
check(assert_type(api.is_interval_dtype(ExtensionDtype), bool), bool)


def test_is_iterator() -> None:
Expand Down Expand Up @@ -327,12 +342,15 @@ def test_is_object_dtype() -> None:


def test_is_period_dtype() -> None:
check(assert_type(api.is_period_dtype(arr), bool), bool)
check(assert_type(api.is_period_dtype(nparr), bool), bool)
check(assert_type(api.is_period_dtype(dtylike), bool), bool)
check(assert_type(api.is_period_dtype(dframe), bool), bool)
check(assert_type(api.is_period_dtype(ind), bool), bool)
check(assert_type(api.is_period_dtype(ExtensionDtype), bool), bool)
with pytest_warns_bounded(
FutureWarning, "is_period_dtype is deprecated", lower="2.0.99"
):
check(assert_type(api.is_period_dtype(arr), bool), bool)
check(assert_type(api.is_period_dtype(nparr), bool), bool)
check(assert_type(api.is_period_dtype(dtylike), bool), bool)
check(assert_type(api.is_period_dtype(dframe), bool), bool)
check(assert_type(api.is_period_dtype(ind), bool), bool)
check(assert_type(api.is_period_dtype(ExtensionDtype), bool), bool)


def test_is_re() -> None:
Expand Down Expand Up @@ -378,9 +396,10 @@ def test_is_signed_integer_dtype() -> None:


def test_is_sparse() -> None:
check(assert_type(api.is_sparse(arr), bool), bool)
check(assert_type(api.is_sparse(nparr), bool), bool)
check(assert_type(api.is_sparse(dframe), bool), bool)
with pytest_warns_bounded(FutureWarning, "is_sparse is deprecated", lower="2.0.99"):
check(assert_type(api.is_sparse(arr), bool), bool)
check(assert_type(api.is_sparse(nparr), bool), bool)
check(assert_type(api.is_sparse(dframe), bool), bool)


def test_is_string_dtype() -> None:
Expand Down
Loading