Skip to content

Commit 731db1a

Browse files
committed
add test for depr is_copy
1 parent 7ef4874 commit 731db1a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/generic/test_generic.py

+12
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,18 @@ def test_take_invalid_kwargs(self):
820820
with pytest.raises(ValueError, match=msg):
821821
obj.take(indices, mode="clip")
822822

823+
def test_depr_take_kwarg_is_copy(self):
824+
# GH 27357
825+
df = DataFrame({"A": [1, 2, 3]})
826+
msg = (
827+
"is_copy is deprecated and will be removed in a future version. "
828+
"take will always return a copy in the future."
829+
)
830+
with tm.assert_produces_warning(FutureWarning) as w:
831+
df.take([0, 1], is_copy=True)
832+
833+
assert w[0].message.args[0] == msg
834+
823835
def test_equals(self):
824836
s1 = pd.Series([1, 2, 3], index=[0, 2, 1])
825837
s2 = s1.copy()

0 commit comments

Comments
 (0)