diff --git a/pandas/tests/frame/methods/test_rename.py b/pandas/tests/frame/methods/test_rename.py index 1581bc8a0c70b..33fb191027c27 100644 --- a/pandas/tests/frame/methods/test_rename.py +++ b/pandas/tests/frame/methods/test_rename.py @@ -184,14 +184,16 @@ def test_rename_inplace(self, float_frame): assert "C" in float_frame assert "foo" not in float_frame - c_id = id(float_frame["C"]) + c_values = float_frame["C"] float_frame = float_frame.copy() return_value = float_frame.rename(columns={"C": "foo"}, inplace=True) assert return_value is None assert "C" not in float_frame assert "foo" in float_frame - assert id(float_frame["foo"]) != c_id + # GH 44153 + # Used to be id(float_frame["foo"]) != c_id, but flaky in the CI + assert float_frame["foo"] is not c_values def test_rename_bug(self): # GH 5344 diff --git a/pandas/tests/frame/methods/test_sort_index.py b/pandas/tests/frame/methods/test_sort_index.py index 71822628473f4..1556a9507ab9e 100644 --- a/pandas/tests/frame/methods/test_sort_index.py +++ b/pandas/tests/frame/methods/test_sort_index.py @@ -224,13 +224,15 @@ def test_sort_index_inplace(self): # axis=0 unordered = frame.loc[[3, 2, 4, 1]] - a_id = id(unordered["A"]) + a_values = unordered["A"] df = unordered.copy() return_value = df.sort_index(inplace=True) assert return_value is None expected = frame tm.assert_frame_equal(df, expected) - assert a_id != id(df["A"]) + # GH 44153 related + # Used to be a_id != id(df["A"]), but flaky in the CI + assert a_values is not df["A"] df = unordered.copy() return_value = df.sort_index(ascending=False, inplace=True)