diff --git a/xarray/tests/test_dataarray.py b/xarray/tests/test_dataarray.py index f3413ea40a4..26a4268c8b7 100644 --- a/xarray/tests/test_dataarray.py +++ b/xarray/tests/test_dataarray.py @@ -3945,7 +3945,8 @@ def test_copy_coords(self, deep, expected_orig) -> None: dims=["a", "b", "c"], ) da_cp = da.copy(deep) - da_cp["a"].data[0] = 999 + new_a = np.array([999, 2]) + da_cp.coords["a"] = da_cp["a"].copy(data=new_a) expected_cp = xr.DataArray( xr.IndexVariable("a", np.array([999, 2])), diff --git a/xarray/tests/test_missing.py b/xarray/tests/test_missing.py index 5968c9687fb..3adcc132b61 100644 --- a/xarray/tests/test_missing.py +++ b/xarray/tests/test_missing.py @@ -164,9 +164,10 @@ def test_interpolate_pd_compat_non_uniform_index(): # for the linear methods. This next line inforces the xarray # fill_value convention on the pandas output. Therefore, this test # only checks that interpolated values are the same (not nans) - expected.values[pd.isnull(actual.values)] = np.nan + expected_values = expected.values.copy() + expected_values[pd.isnull(actual.values)] = np.nan - np.testing.assert_allclose(actual.values, expected.values) + np.testing.assert_allclose(actual.values, expected_values) @requires_scipy