Create default indexes if the backend does not create them.
(self, create_default_indexes)
| 290 | |
| 291 | @pytest.mark.parametrize("create_default_indexes", [True, False]) |
| 292 | def test_default_indexes(self, create_default_indexes): |
| 293 | """Create default indexes if the backend does not create them.""" |
| 294 | coords = xr.Coordinates({"x": ("x", [0, 1]), "y": list("abc")}, indexes={}) |
| 295 | initial = xr.Dataset({"a": ("x", [1, 2])}, coords=coords) |
| 296 | |
| 297 | with assert_no_warnings(): |
| 298 | final = xr.open_dataset( |
| 299 | initial, |
| 300 | engine=PassThroughBackendEntrypoint, |
| 301 | create_default_indexes=create_default_indexes, |
| 302 | ) |
| 303 | |
| 304 | if create_default_indexes: |
| 305 | assert all(name in final.xindexes for name in ["x", "y"]) |
| 306 | else: |
| 307 | assert len(final.xindexes) == 0 |
| 308 | |
| 309 | @pytest.mark.parametrize("create_default_indexes", [True, False]) |
| 310 | def test_default_indexes_passthrough(self, create_default_indexes): |
nothing calls this directly
no test coverage detected