(self, tmp_path, create_default_indexes)
| 2242 | |
| 2243 | @pytest.mark.parametrize("create_default_indexes", [True, False]) |
| 2244 | def test_create_default_indexes(self, tmp_path, create_default_indexes) -> None: |
| 2245 | store_path = tmp_path / "tmp.nc" |
| 2246 | original_ds = xr.Dataset( |
| 2247 | {"data": ("x", np.arange(3))}, coords={"x": [-1, 0, 1]} |
| 2248 | ) |
| 2249 | original_ds.to_netcdf(store_path, engine=self.engine, mode="w") |
| 2250 | |
| 2251 | with open_dataset( |
| 2252 | store_path, |
| 2253 | engine=self.engine, |
| 2254 | create_default_indexes=create_default_indexes, |
| 2255 | ) as loaded_ds: |
| 2256 | if create_default_indexes: |
| 2257 | assert list(loaded_ds.xindexes) == ["x"] and isinstance( |
| 2258 | loaded_ds.xindexes["x"], PandasIndex |
| 2259 | ) |
| 2260 | else: |
| 2261 | assert len(loaded_ds.xindexes) == 0 |
| 2262 | |
| 2263 | @requires_dask |
| 2264 | def test_encoding_masked_arrays(self, tmp_path) -> None: |
nothing calls this directly
no test coverage detected