File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -912,8 +912,21 @@ def test_contains_requires_hashable_raises(self):
912912 with pytest .raises (TypeError ):
913913 {} in idx ._engine
914914
915+ def test_copy_copies_cache (self ):
916+ # GH32883
917+ idx = self .create_index ()
918+ idx .get_loc (idx [0 ]) # populates the _cache.
919+ copy = idx .copy ()
920+
921+ # check that the copied cache is a copy of the original
922+ assert idx ._cache == copy ._cache
923+ assert idx ._cache is not copy ._cache
924+ # cache values should reference the same object
925+ for key , val in idx ._cache .items ():
926+ assert copy ._cache [key ] is val , key
927+
915928 def test_shallow_copy_copies_cache (self ):
916- # GH32669
929+ # GH32898
917930 idx = self .create_index ()
918931 idx .get_loc (idx [0 ]) # populates the _cache.
919932 shallow_copy = idx ._shallow_copy ()
You can’t perform that action at this time.
0 commit comments