Skip to content

Commit

Permalink
Change is_.._dtype deprecations to DeprecationWarning instead of …
Browse files Browse the repository at this point in the history
…`FutureWarning` (#14617)

This PR changes all FutureWarning's to DeprecationWarning's to match with pandas: pandas-dev/pandas#55703

On pandas_2.0_feature_branch:

= 501 failed, 101106 passed, 2071 skipped, 786 xfailed, 312 xpassed, 20 errors in 1234.91s (0:20:34) =
This PR:

= 445 failed, 101162 passed, 2071 skipped, 786 xfailed, 312 xpassed, 20 errors in 1216.79s (0:20:16) =
  • Loading branch information
galipremsagar committed Dec 18, 2023
1 parent eea5f10 commit bc5584b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ repos:
entry: '(category=|\s)DeprecationWarning[,)]'
language: pygrep
types_or: [python, cython]
exclude: |
(?x)^(
^python/cudf/cudf/core/dtypes.py
)
- id: no-programmatic-xfail
name: no-programmatic-xfail
description: 'Enforce that pytest.xfail is not introduced (see dev docs for details)'
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/core/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
PANDAS_EQ_200 = PANDAS_VERSION == version.parse("2.0.0")
PANDAS_GE_200 = PANDAS_VERSION >= version.parse("2.0.0")
PANDAS_GE_210 = PANDAS_VERSION >= version.parse("2.1.0")
PANDAS_GE_214 = PANDAS_VERSION >= version.parse("2.1.4")
PANDAS_GE_220 = PANDAS_VERSION >= version.parse("2.2.0")
4 changes: 2 additions & 2 deletions python/cudf/cudf/core/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def is_categorical_dtype(obj):
warnings.warn(
"is_categorical_dtype is deprecated and will be removed in a future "
"version. Use isinstance(dtype, cudf.CategoricalDtype) instead",
FutureWarning,
DeprecationWarning,
)
return _is_categorical_dtype(obj)

Expand Down Expand Up @@ -1151,7 +1151,7 @@ def is_interval_dtype(obj):
warnings.warn(
"is_interval_dtype is deprecated and will be removed in a "
"future version. Use `isinstance(dtype, cudf.IntervalDtype)` instead",
FutureWarning,
DeprecationWarning,
)
return _is_interval_dtype(obj)

Expand Down
8 changes: 5 additions & 3 deletions python/cudf/cudf/tests/test_api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pandas.api import types as pd_types

import cudf
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210, PANDAS_GE_214
from cudf.api import types

from cudf.testing._utils import expect_warning_if
Expand Down Expand Up @@ -1038,9 +1038,11 @@ def test_is_decimal_dtype(obj, expect):
),
)
def test_pandas_agreement(obj):
with expect_warning_if(PANDAS_GE_210):
with expect_warning_if(
PANDAS_GE_210, DeprecationWarning if PANDAS_GE_214 else FutureWarning
):
expected = pd_types.is_categorical_dtype(obj)
with pytest.warns(FutureWarning):
with pytest.warns(DeprecationWarning):
actual = types.is_categorical_dtype(obj)
assert expected == actual
assert types.is_numeric_dtype(obj) == pd_types.is_numeric_dtype(obj)
Expand Down

0 comments on commit bc5584b

Please sign in to comment.