File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import pandas .util .testing as tm
8
8
from pandas .core .dtypes .dtypes import CategoricalDtype
9
- from pandas import Categorical , Index , CategoricalIndex
9
+ from pandas import Categorical , Index , CategoricalIndex , Series
10
10
11
11
12
12
class TestCategoricalDtypes (object ):
@@ -30,6 +30,17 @@ def test_is_equal_dtype(self):
30
30
CategoricalIndex (c1 , categories = list ('cab' ))))
31
31
assert not c1 .is_dtype_equal (CategoricalIndex (c1 , ordered = True ))
32
32
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
+
33
44
def test_set_dtype_same (self ):
34
45
c = Categorical (['a' , 'b' , 'c' ])
35
46
result = c ._set_dtype (CategoricalDtype (['a' , 'b' , 'c' ]))
You can’t perform that action at this time.
0 commit comments