Skip to content

Commit ed5c814

Browse files
committed
update
1 parent 790cd42 commit ed5c814

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

pandas/core/categorical.py

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ class Categorical(PandasObject):
222222
Categorical.order
223223
Categorical.min
224224
Categorical.max
225+
pandas.api.types.CategoricalDtype
225226
"""
226227

227228
# For comparisons, so that numpy uses our implementation if the compare

pandas/tests/dtypes/test_dtypes.py

+3
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ def test_invalid_raises(self):
615615
with tm.assert_raises_regex(TypeError, 'ordered'):
616616
CategoricalDtype(['a', 'b'], ordered='foo')
617617

618+
with tm.assert_raises_regex(TypeError, 'collection'):
619+
CategoricalDtype('category')
620+
618621
def test_mixed(self):
619622
a = CategoricalDtype(['a', 'b', 1, 2])
620623
b = CategoricalDtype(['a', 'b', '1', '2'])

pandas/util/testing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1244,9 +1244,11 @@ def assert_series_equal(left, right, check_dtype=True,
12441244
obj='{obj}.index'.format(obj=obj))
12451245

12461246
if check_dtype:
1247+
# We want to skip exact dtype checking when `check_categorical`
1248+
# is False. We'll still raise if only one is a `Categorical`,
1249+
# regardless of `check_categorical`
12471250
if (is_categorical_dtype(left) and is_categorical_dtype(right) and
12481251
not check_categorical):
1249-
# compat with pandas 0.21.0 CategoricalDtype
12501252
pass
12511253
else:
12521254
assert_attr_equal('dtype', left, right)

0 commit comments

Comments
 (0)