| 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 |