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

Method test_align_index_var_attrs

xarray/tests/test_dataset.py:2757–2768  ·  view source on GitHub ↗
(self, join)

Source from the content-addressed store, hash-verified

2755
2756 @pytest.mark.parametrize("join", ["left", "override"])
2757 def test_align_index_var_attrs(self, join) -> None:
2758 # regression test https://github.com/pydata/xarray/issues/6852
2759 # aligning two objects should have no side effect on their index variable
2760 # metadata.
2761
2762 ds = Dataset(coords={"x": ("x", [1, 2, 3], {"units": "m"})})
2763 ds_noattr = Dataset(coords={"x": ("x", [1, 2, 3])})
2764
2765 xr.align(ds_noattr, ds, join=join)
2766
2767 assert ds.x.attrs == {"units": "m"}
2768 assert ds_noattr.x.attrs == {}
2769
2770 def test_align_scalar_index(self) -> None:
2771 # ensure that indexes associated with scalar coordinates are not ignored

Callers

nothing calls this directly

Calls 2

DatasetClass · 0.90
alignMethod · 0.80

Tested by

no test coverage detected