()
| 134 | |
| 135 | |
| 136 | def test_multiindex() -> None: |
| 137 | # GH7139 |
| 138 | # Check that we properly handle backends that change index variables |
| 139 | dataset = xr.Dataset(coords={"coord1": ["A", "B"], "coord2": [1, 2]}) |
| 140 | dataset = dataset.stack(z=["coord1", "coord2"]) |
| 141 | |
| 142 | class MultiindexBackend(xr.backends.BackendEntrypoint): |
| 143 | def open_dataset( |
| 144 | self, |
| 145 | filename_or_obj, |
| 146 | drop_variables=None, |
| 147 | **kwargs, |
| 148 | ) -> xr.Dataset: |
| 149 | return dataset.copy(deep=True) |
| 150 | |
| 151 | loaded = xr.open_dataset("fake_filename", engine=MultiindexBackend) |
| 152 | assert_identical(dataset, loaded) |
| 153 | |
| 154 | |
| 155 | class PassThroughBackendEntrypoint(xr.backends.BackendEntrypoint): |
nothing calls this directly
no test coverage detected
searching dependent graphs…