diff --git a/python/cudf/cudf/tests/test_setitem.py b/python/cudf/cudf/tests/test_setitem.py index de0826d61e9..967c1d27fc1 100644 --- a/python/cudf/cudf/tests/test_setitem.py +++ b/python/cudf/cudf/tests/test_setitem.py @@ -118,34 +118,23 @@ def test_series_setitem_singleton_range(): assert_eq(sr, psr, check_dtype=True) +@pytest.mark.xfail(reason="Copy-on-Write should make a copy") @pytest.mark.parametrize( - "df", + "index", [ - pd.DataFrame( - {"a": [1, 2, 3]}, - index=pd.MultiIndex.from_frame( - pd.DataFrame({"b": [3, 2, 1], "c": ["a", "b", "c"]}) - ), + pd.MultiIndex.from_frame( + pd.DataFrame({"b": [3, 2, 1], "c": ["a", "b", "c"]}) ), - pd.DataFrame({"a": [1, 2, 3]}, index=["a", "b", "c"]), + ["a", "b", "c"], ], ) -def test_setitem_dataframe_series_inplace(df): - pdf = df.copy(deep=True) - gdf = cudf.from_pandas(pdf) - - pdf["a"].replace(1, 500, inplace=True) - gdf["a"].replace(1, 500, inplace=True) - - assert_eq(pdf, gdf) - - psr_a = pdf["a"] - gsr_a = gdf["a"] - - psr_a.replace(500, 501, inplace=True) - gsr_a.replace(500, 501, inplace=True) +def test_setitem_dataframe_series_inplace(index): + gdf = cudf.DataFrame({"a": [1, 2, 3]}, index=index) + expected = gdf.copy() + with cudf.option_context("copy_on_write", True): + gdf["a"].replace(1, 500, inplace=True) - assert_eq(pdf, gdf) + assert_eq(expected, gdf) @pytest.mark.parametrize(