| 4112 | |
| 4113 | |
| 4114 | def test_copy(): |
| 4115 | df = pd.DataFrame({"x": [1, 2, 3]}) |
| 4116 | |
| 4117 | a = dd.from_pandas(df, npartitions=2) |
| 4118 | b = a.copy() |
| 4119 | c = a.copy(deep=False) |
| 4120 | |
| 4121 | a["y"] = a.x * 2 |
| 4122 | |
| 4123 | assert_eq(b, df) |
| 4124 | assert_eq(c, df) |
| 4125 | |
| 4126 | deep_err = ( |
| 4127 | "The `deep` value must be False. This is strictly a shallow copy " |
| 4128 | "of the underlying computational graph." |
| 4129 | ) |
| 4130 | for deep in [True, None, ""]: |
| 4131 | with pytest.raises(ValueError, match=deep_err): |
| 4132 | a.copy(deep=deep) |
| 4133 | |
| 4134 | |
| 4135 | def test_del(): |