Permalink
Browse files

TST: check cache clearing for inplace sort_index and rename

  • Loading branch information...
1 parent 3b9f027 commit 234843b5fe34dfd172e0c49038bf275fb43a0a63 Chang She committed May 21, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 pandas/tests/test_frame.py
View
@@ -3812,9 +3812,13 @@ def test_rename_inplace(self):
self.assert_('C' in self.frame)
self.assert_('foo' not in self.frame)
- self.frame.rename(columns={'C' : 'foo'}, inplace=True)
- self.assert_('C' not in self.frame)
- self.assert_('foo' in self.frame)
+ c_id = id(self.frame['C'])
+ frame = self.frame.copy()
+ frame.rename(columns={'C' : 'foo'}, inplace=True)
+ self.assert_('C' not in frame)
+ self.assert_('foo' in frame)
+ self.assert_(id(frame['foo']) != c_id)
+
#----------------------------------------------------------------------
# Time series related
@@ -4276,10 +4280,12 @@ def test_sort_index_inplace(self):
# axis=0
unordered = frame.ix[[3, 2, 4, 1]]
+ a_id = id(unordered['A'])
df = unordered.copy()
df.sort_index(inplace=True)
expected = frame
assert_frame_equal(df, expected)
+ self.assert_(a_id != id(df['A']))
df = unordered.copy()
df.sort_index(ascending=False, inplace=True)

0 comments on commit 234843b

Please sign in to comment.