Skip to content

Commit a7b536c

Browse files
authored
CI/TST: Change id to is for flaky tests (#44650)
1 parent 4569269 commit a7b536c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pandas/tests/frame/methods/test_rename.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,16 @@ def test_rename_inplace(self, float_frame):
184184
assert "C" in float_frame
185185
assert "foo" not in float_frame
186186

187-
c_id = id(float_frame["C"])
187+
c_values = float_frame["C"]
188188
float_frame = float_frame.copy()
189189
return_value = float_frame.rename(columns={"C": "foo"}, inplace=True)
190190
assert return_value is None
191191

192192
assert "C" not in float_frame
193193
assert "foo" in float_frame
194-
assert id(float_frame["foo"]) != c_id
194+
# GH 44153
195+
# Used to be id(float_frame["foo"]) != c_id, but flaky in the CI
196+
assert float_frame["foo"] is not c_values
195197

196198
def test_rename_bug(self):
197199
# GH 5344

pandas/tests/frame/methods/test_sort_index.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ def test_sort_index_inplace(self):
224224

225225
# axis=0
226226
unordered = frame.loc[[3, 2, 4, 1]]
227-
a_id = id(unordered["A"])
227+
a_values = unordered["A"]
228228
df = unordered.copy()
229229
return_value = df.sort_index(inplace=True)
230230
assert return_value is None
231231
expected = frame
232232
tm.assert_frame_equal(df, expected)
233-
assert a_id != id(df["A"])
233+
# GH 44153 related
234+
# Used to be a_id != id(df["A"]), but flaky in the CI
235+
assert a_values is not df["A"]
234236

235237
df = unordered.copy()
236238
return_value = df.sort_index(ascending=False, inplace=True)

0 commit comments

Comments
 (0)