MCPcopy Index your code
hub / github.com/pydata/xarray / test_align_nocopy

Method test_align_nocopy

xarray/tests/test_dataset.py:2678–2694  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2676 assert_identical(expected_y2, y2)
2677
2678 def test_align_nocopy(self) -> None:
2679 x = Dataset({"foo": DataArray([1, 2, 3], coords=[("x", [1, 2, 3])])})
2680 y = Dataset({"foo": DataArray([1, 2], coords=[("x", [1, 2])])})
2681 expected_x2 = x
2682 expected_y2 = Dataset(
2683 {"foo": DataArray([1, 2, np.nan], coords=[("x", [1, 2, 3])])}
2684 )
2685
2686 x2, y2 = align(x, y, copy=False, join="outer")
2687 assert_identical(expected_x2, x2)
2688 assert_identical(expected_y2, y2)
2689 assert source_ndarray(x["foo"].data) is source_ndarray(x2["foo"].data)
2690
2691 x2, y2 = align(x, y, copy=True, join="outer")
2692 assert source_ndarray(x["foo"].data) is not source_ndarray(x2["foo"].data)
2693 assert_identical(expected_x2, x2)
2694 assert_identical(expected_y2, y2)
2695
2696 def test_align_indexes(self) -> None:
2697 x = Dataset({"foo": DataArray([1, 2, 3], dims="x", coords=[("x", [1, 2, 3])])})

Callers

nothing calls this directly

Calls 5

DatasetClass · 0.90
DataArrayClass · 0.90
alignFunction · 0.90
assert_identicalFunction · 0.90
source_ndarrayFunction · 0.90

Tested by

no test coverage detected