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

Method test_copy

xarray/tests/test_coordinates.py:177–191  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

175 assert_identical(actual, expected)
176
177 def test_copy(self) -> None:
178 no_index_coords = Coordinates({"foo": ("x", [1, 2, 3])})
179 copied = no_index_coords.copy()
180 assert_identical(no_index_coords, copied)
181 v0 = no_index_coords.variables["foo"]
182 v1 = copied.variables["foo"]
183 assert v0 is not v1
184 assert source_ndarray(v0.data) is source_ndarray(v1.data)
185
186 deep_copied = no_index_coords.copy(deep=True)
187 assert_identical(no_index_coords.to_dataset(), deep_copied.to_dataset())
188 v0 = no_index_coords.variables["foo"]
189 v1 = deep_copied.variables["foo"]
190 assert v0 is not v1
191 assert source_ndarray(v0.data) is not source_ndarray(v1.data)
192
193 def test_align(self) -> None:
194 coords = Coordinates(coords={"x": [0, 1, 2]})

Callers

nothing calls this directly

Calls 6

copyMethod · 0.95
to_datasetMethod · 0.95
CoordinatesClass · 0.90
assert_identicalFunction · 0.90
source_ndarrayFunction · 0.90
to_datasetMethod · 0.45

Tested by

no test coverage detected