Skip to content

Commit 9f2e183

Browse files
committed
improve test
1 parent d6f98ff commit 9f2e183

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas/tests/frame/methods/test_set_axis.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,21 @@ def test_set_axis_copy(self, obj, using_copy_on_write):
5757
result = obj.set_axis(new_index, axis=0)
5858
tm.assert_equal(expected, result)
5959
assert result is not obj
60-
# check we DID make a copy
61-
if not using_copy_on_write:
60+
if using_copy_on_write:
61+
# check we DID NOT make a copy
6262
if obj.ndim == 1:
63-
assert not tm.shares_memory(result, obj)
63+
assert tm.shares_memory(result, obj)
6464
else:
65-
assert not any(
65+
assert any(
6666
tm.shares_memory(result.iloc[:, i], obj.iloc[:, i])
6767
for i in range(obj.shape[1])
6868
)
6969
else:
70+
# check we DID make a copy
7071
if obj.ndim == 1:
71-
assert tm.shares_memory(result, obj)
72+
assert not tm.shares_memory(result, obj)
7273
else:
73-
assert any(
74+
assert not any(
7475
tm.shares_memory(result.iloc[:, i], obj.iloc[:, i])
7576
for i in range(obj.shape[1])
7677
)

0 commit comments

Comments
 (0)