File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 66
77import pandas .util .testing as tm
88from pandas .core .dtypes .dtypes import CategoricalDtype
9- from pandas import Categorical , Index , CategoricalIndex
9+ from pandas import Categorical , Index , CategoricalIndex , Series
1010
1111
1212class TestCategoricalDtypes (object ):
@@ -30,6 +30,17 @@ def test_is_equal_dtype(self):
3030 CategoricalIndex (c1 , categories = list ('cab' ))))
3131 assert not c1 .is_dtype_equal (CategoricalIndex (c1 , ordered = True ))
3232
33+ # GH 16659
34+ s1 = Series (c1 )
35+ s2 = Series (c2 )
36+ s3 = Series (c3 )
37+ assert c1 .is_dtype_equal (s1 )
38+ assert c2 .is_dtype_equal (s2 )
39+ assert c3 .is_dtype_equal (s3 )
40+ assert c1 .is_dtype_equal (s2 )
41+ assert not c1 .is_dtype_equal (s3 )
42+ assert not c1 .is_dtype_equal (s1 .astype (object ))
43+
3344 def test_set_dtype_same (self ):
3445 c = Categorical (['a' , 'b' , 'c' ])
3546 result = c ._set_dtype (CategoricalDtype (['a' , 'b' , 'c' ]))
You can’t perform that action at this time.
0 commit comments