MCPcopy
hub / github.com/pydata/xarray / test_assign_coords_custom_index

Method test_assign_coords_custom_index

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

Source from the content-addressed store, hash-verified

5129 assert isinstance(actual.xindexes["x"], CustomIndex)
5130
5131 def test_assign_coords_custom_index(self) -> None:
5132 class CustomIndex(Index):
5133 pass
5134
5135 coords = Coordinates(
5136 coords={"x": ("x", [1, 2, 3])}, indexes={"x": CustomIndex()}
5137 )
5138 ds = Dataset()
5139 actual = ds.assign_coords(coords)
5140 assert isinstance(actual.xindexes["x"], CustomIndex)
5141
5142 def test_assign_coords_no_default_index(self) -> None:
5143 coords = Coordinates({"y": [1, 2, 3]}, indexes={})

Callers

nothing calls this directly

Calls 4

CoordinatesClass · 0.90
DatasetClass · 0.90
CustomIndexClass · 0.70
assign_coordsMethod · 0.45

Tested by

no test coverage detected