Skip to content

Commit bc5584b

Browse files
Change is_.._dtype deprecations to DeprecationWarning instead of 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) =
1 parent eea5f10 commit bc5584b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ repos:
9191
entry: '(category=|\s)DeprecationWarning[,)]'
9292
language: pygrep
9393
types_or: [python, cython]
94+
exclude: |
95+
(?x)^(
96+
^python/cudf/cudf/core/dtypes.py
97+
)
9498
- id: no-programmatic-xfail
9599
name: no-programmatic-xfail
96100
description: 'Enforce that pytest.xfail is not introduced (see dev docs for details)'

python/cudf/cudf/core/_compat.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
PANDAS_EQ_200 = PANDAS_VERSION == version.parse("2.0.0")
1313
PANDAS_GE_200 = PANDAS_VERSION >= version.parse("2.0.0")
1414
PANDAS_GE_210 = PANDAS_VERSION >= version.parse("2.1.0")
15+
PANDAS_GE_214 = PANDAS_VERSION >= version.parse("2.1.4")
1516
PANDAS_GE_220 = PANDAS_VERSION >= version.parse("2.2.0")

python/cudf/cudf/core/dtypes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ def is_categorical_dtype(obj):
10431043
warnings.warn(
10441044
"is_categorical_dtype is deprecated and will be removed in a future "
10451045
"version. Use isinstance(dtype, cudf.CategoricalDtype) instead",
1046-
FutureWarning,
1046+
DeprecationWarning,
10471047
)
10481048
return _is_categorical_dtype(obj)
10491049

@@ -1151,7 +1151,7 @@ def is_interval_dtype(obj):
11511151
warnings.warn(
11521152
"is_interval_dtype is deprecated and will be removed in a "
11531153
"future version. Use `isinstance(dtype, cudf.IntervalDtype)` instead",
1154-
FutureWarning,
1154+
DeprecationWarning,
11551155
)
11561156
return _is_interval_dtype(obj)
11571157

python/cudf/cudf/tests/test_api_types.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pandas.api import types as pd_types
77

88
import cudf
9-
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210
9+
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210, PANDAS_GE_214
1010
from cudf.api import types
1111

1212
from cudf.testing._utils import expect_warning_if
@@ -1038,9 +1038,11 @@ def test_is_decimal_dtype(obj, expect):
10381038
),
10391039
)
10401040
def test_pandas_agreement(obj):
1041-
with expect_warning_if(PANDAS_GE_210):
1041+
with expect_warning_if(
1042+
PANDAS_GE_210, DeprecationWarning if PANDAS_GE_214 else FutureWarning
1043+
):
10421044
expected = pd_types.is_categorical_dtype(obj)
1043-
with pytest.warns(FutureWarning):
1045+
with pytest.warns(DeprecationWarning):
10441046
actual = types.is_categorical_dtype(obj)
10451047
assert expected == actual
10461048
assert types.is_numeric_dtype(obj) == pd_types.is_numeric_dtype(obj)

0 commit comments

Comments
 (0)