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

Method test_copy

xarray/tests/test_variable.py:563–574  ·  view source on GitHub ↗
(self, deep: bool, astype: type[object])

Source from the content-addressed store, hash-verified

561 @pytest.mark.parametrize("deep", [True, False])
562 @pytest.mark.parametrize("astype", [float, int, str])
563 def test_copy(self, deep: bool, astype: type[object]) -> None:
564 v = self.cls("x", (0.5 * np.arange(10)).astype(astype), {"foo": "bar"})
565 w = v.copy(deep=deep)
566 assert type(v) is type(w)
567 assert_identical(v, w)
568 assert v.dtype == w.dtype
569 if self.cls is Variable:
570 if deep:
571 assert source_ndarray(v.values) is not source_ndarray(w.values)
572 else:
573 assert source_ndarray(v.values) is source_ndarray(w.values)
574 assert_identical(v, copy(v))
575
576 def test_copy_deep_recursive(self) -> None:
577 # GH:issue:7111

Callers

nothing calls this directly

Calls 7

assert_identicalFunction · 0.90
source_ndarrayFunction · 0.90
typeFunction · 0.85
arangeMethod · 0.80
clsMethod · 0.45
astypeMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected