From 151c76a2d59227faad9cfb5809d3270afc387fa2 Mon Sep 17 00:00:00 2001 From: jschendel Date: Tue, 2 Jan 2018 18:41:20 -0700 Subject: [PATCH] TST: Add tests for Categorical.is_dtype_equal against Series --- pandas/tests/categorical/test_dtypes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pandas/tests/categorical/test_dtypes.py b/pandas/tests/categorical/test_dtypes.py index bad2c27026b31..8973d1196f6a9 100644 --- a/pandas/tests/categorical/test_dtypes.py +++ b/pandas/tests/categorical/test_dtypes.py @@ -6,7 +6,7 @@ import pandas.util.testing as tm from pandas.core.dtypes.dtypes import CategoricalDtype -from pandas import Categorical, Index, CategoricalIndex +from pandas import Categorical, Index, CategoricalIndex, Series class TestCategoricalDtypes(object): @@ -30,6 +30,17 @@ def test_is_equal_dtype(self): CategoricalIndex(c1, categories=list('cab')))) assert not c1.is_dtype_equal(CategoricalIndex(c1, ordered=True)) + # GH 16659 + s1 = Series(c1) + s2 = Series(c2) + s3 = Series(c3) + assert c1.is_dtype_equal(s1) + assert c2.is_dtype_equal(s2) + assert c3.is_dtype_equal(s3) + assert c1.is_dtype_equal(s2) + assert not c1.is_dtype_equal(s3) + assert not c1.is_dtype_equal(s1.astype(object)) + def test_set_dtype_same(self): c = Categorical(['a', 'b', 'c']) result = c._set_dtype(CategoricalDtype(['a', 'b', 'c']))