@@ -49,12 +49,12 @@ def test_categories_match_up_to_permutation(self):
49
49
50
50
def test_set_dtype_same (self ):
51
51
c = Categorical (["a" , "b" , "c" ])
52
- result = c ._set_dtype (CategoricalDtype (["a" , "b" , "c" ]))
52
+ result = c ._set_dtype (CategoricalDtype (["a" , "b" , "c" ]), copy = True )
53
53
tm .assert_categorical_equal (result , c )
54
54
55
55
def test_set_dtype_new_categories (self ):
56
56
c = Categorical (["a" , "b" , "c" ])
57
- result = c ._set_dtype (CategoricalDtype (list ("abcd" )))
57
+ result = c ._set_dtype (CategoricalDtype (list ("abcd" )), copy = True )
58
58
tm .assert_numpy_array_equal (result .codes , c .codes )
59
59
tm .assert_index_equal (result .dtype .categories , Index (list ("abcd" )))
60
60
@@ -86,12 +86,12 @@ def test_set_dtype_new_categories(self):
86
86
def test_set_dtype_many (self , values , categories , new_categories , ordered ):
87
87
c = Categorical (values , categories )
88
88
expected = Categorical (values , new_categories , ordered )
89
- result = c ._set_dtype (expected .dtype )
89
+ result = c ._set_dtype (expected .dtype , copy = True )
90
90
tm .assert_categorical_equal (result , expected )
91
91
92
92
def test_set_dtype_no_overlap (self ):
93
93
c = Categorical (["a" , "b" , "c" ], ["d" , "e" ])
94
- result = c ._set_dtype (CategoricalDtype (["a" , "b" ]))
94
+ result = c ._set_dtype (CategoricalDtype (["a" , "b" ]), copy = True )
95
95
expected = Categorical ([None , None , None ], categories = ["a" , "b" ])
96
96
tm .assert_categorical_equal (result , expected )
97
97
0 commit comments