@@ -141,8 +141,9 @@ def test_is_equal_dtype(self):
141
141
c2 = Categorical (list ('aabca' ), categories = list ('cab' ), ordered = False )
142
142
c3 = Categorical (list ('aabca' ), categories = list ('cab' ), ordered = True )
143
143
assert c1 .is_dtype_equal (c1 )
144
- assert c2 .is_dtype_equal (c2 ) # XXX: changed
144
+ assert c2 .is_dtype_equal (c2 )
145
145
assert c3 .is_dtype_equal (c3 )
146
+ assert c1 .is_dtype_equal (c2 )
146
147
assert not c1 .is_dtype_equal (c3 )
147
148
assert not c1 .is_dtype_equal (Index (list ('aabca' )))
148
149
assert not c1 .is_dtype_equal (c1 .astype (object ))
@@ -191,11 +192,8 @@ def f():
191
192
192
193
c1 = Categorical (["a" , "b" , "c" , "a" ], categories = ["a" , "c" , "b" ])
193
194
c2 = Categorical (c1 , categories = ["a" , "b" , "c" ])
194
- # XXX: change
195
- # tm.assert_numpy_array_equal(c1.__array__(), c2.__array__())
196
- assert set (c2 .categories ) == {'a' , 'b' , 'c' }
197
- # XXX: change
198
- # tm.assert_index_equal(c2.categories, Index(["a", "b", "c"]))
195
+ tm .assert_numpy_array_equal (c1 .__array__ (), c2 .__array__ ())
196
+ tm .assert_index_equal (c2 .categories , Index (["a" , "b" , "c" ]))
199
197
200
198
# Series of dtype category
201
199
c1 = Categorical (["a" , "b" , "c" , "a" ], categories = ["a" , "b" , "c" , "d" ])
@@ -814,14 +812,12 @@ def test_construction_with_ordered(self):
814
812
def test_ordered_api (self ):
815
813
# GH 9347
816
814
cat1 = pd .Categorical (["a" , "c" , "b" ], ordered = False )
817
- # XXX: changed
818
- assert set (cat1 .categories ) == {'a' , 'b' , 'c' }
815
+ tm .assert_index_equal (cat1 .categories , Index (['a' , 'b' , 'c' ]))
819
816
assert not cat1 .ordered
820
817
821
818
cat2 = pd .Categorical (["a" , "c" , "b" ], categories = ['b' , 'c' , 'a' ],
822
819
ordered = False )
823
- # XXX: changed
824
- assert set (cat1 .categories ) == {'a' , 'b' , 'c' }
820
+ tm .assert_index_equal (cat2 .categories , Index (['b' , 'c' , 'a' ]))
825
821
assert not cat2 .ordered
826
822
827
823
cat3 = pd .Categorical (["a" , "c" , "b" ], ordered = True )
@@ -1224,8 +1220,7 @@ def test_unique(self):
1224
1220
categories = ["a" , "b" , "c" ])
1225
1221
exp = Index (["c" , "a" , "b" ])
1226
1222
res = cat .unique ()
1227
- # XXX: changed
1228
- assert set (res .categories ) == set (exp )
1223
+ tm .assert_index_equal (res .categories , exp )
1229
1224
exp_cat = Categorical (exp , categories = ['c' , 'a' , 'b' ])
1230
1225
tm .assert_categorical_equal (res , exp_cat )
1231
1226
0 commit comments