@@ -49,12 +49,12 @@ def test_categories_match_up_to_permutation(self):
4949
5050 def test_set_dtype_same (self ):
5151 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 )
5353 tm .assert_categorical_equal (result , c )
5454
5555 def test_set_dtype_new_categories (self ):
5656 c = Categorical (["a" , "b" , "c" ])
57- result = c ._set_dtype (CategoricalDtype (list ("abcd" )))
57+ result = c ._set_dtype (CategoricalDtype (list ("abcd" )), copy = True )
5858 tm .assert_numpy_array_equal (result .codes , c .codes )
5959 tm .assert_index_equal (result .dtype .categories , Index (list ("abcd" )))
6060
@@ -86,12 +86,12 @@ def test_set_dtype_new_categories(self):
8686 def test_set_dtype_many (self , values , categories , new_categories , ordered ):
8787 c = Categorical (values , categories )
8888 expected = Categorical (values , new_categories , ordered )
89- result = c ._set_dtype (expected .dtype )
89+ result = c ._set_dtype (expected .dtype , copy = True )
9090 tm .assert_categorical_equal (result , expected )
9191
9292 def test_set_dtype_no_overlap (self ):
9393 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 )
9595 expected = Categorical ([None , None , None ], categories = ["a" , "b" ])
9696 tm .assert_categorical_equal (result , expected )
9797
0 commit comments