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

Method test_constructor_multiindex

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

Source from the content-addressed store, hash-verified

656 assert "x" not in ds.xindexes
657
658 def test_constructor_multiindex(self) -> None:
659 midx = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("one", "two"))
660 coords = Coordinates.from_pandas_multiindex(midx, "x")
661
662 ds = Dataset(coords=coords)
663 assert_identical(ds, coords.to_dataset())
664
665 with pytest.warns(
666 FutureWarning,
667 match=r".*`pandas.MultiIndex`.*no longer be implicitly promoted.*",
668 ):
669 Dataset(data_vars={"x": midx})
670
671 with pytest.warns(
672 FutureWarning,
673 match=r".*`pandas.MultiIndex`.*no longer be implicitly promoted.*",
674 ):
675 Dataset(coords={"x": midx})
676
677 def test_constructor_custom_index(self) -> None:
678 class CustomIndex(Index): ...

Callers

nothing calls this directly

Calls 4

DatasetClass · 0.90
assert_identicalFunction · 0.90
to_datasetMethod · 0.45

Tested by

no test coverage detected