Skip to content

Commit d6f98ff

Browse files
committed
fix error in test for when copy is True
1 parent 656ddd8 commit d6f98ff

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

pandas/tests/frame/methods/test_set_axis.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,14 @@ def test_set_axis_copy(self, obj, using_copy_on_write):
3232
result = obj.set_axis(new_index, axis=0, copy=True)
3333
tm.assert_equal(expected, result)
3434
assert result is not obj
35-
if not using_copy_on_write:
36-
# check we DID make a copy
37-
if obj.ndim == 1:
38-
assert not tm.shares_memory(result, obj)
39-
else:
40-
assert not any(
41-
tm.shares_memory(result.iloc[:, i], obj.iloc[:, i])
42-
for i in range(obj.shape[1])
43-
)
35+
# check we DID make a copy
36+
if obj.ndim == 1:
37+
assert not tm.shares_memory(result, obj)
4438
else:
45-
if obj.ndim == 1:
46-
assert tm.shares_memory(result, obj)
47-
else:
48-
assert any(
49-
tm.shares_memory(result.iloc[:, i], obj.iloc[:, i])
50-
for i in range(obj.shape[1])
51-
)
39+
assert not any(
40+
tm.shares_memory(result.iloc[:, i], obj.iloc[:, i])
41+
for i in range(obj.shape[1])
42+
)
5243

5344
result = obj.set_axis(new_index, axis=0, copy=False)
5445
tm.assert_equal(expected, result)

0 commit comments

Comments
 (0)