Skip to content

adapt more tests to the copy-on-write behavior of pandas #8940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])),
Expand Down
5 changes: 3 additions & 2 deletions xarray/tests/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading