From d0c1c13f3a6207107a20cc0f716fe022762cff89 Mon Sep 17 00:00:00 2001 From: Raphael Hagen Date: Tue, 27 Aug 2024 09:39:04 -0600 Subject: [PATCH] removed test_cftime_variables_must_be_in_loadable_variables test & updated xr.open_dataset decode behavior --- virtualizarr/tests/test_backend.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/virtualizarr/tests/test_backend.py b/virtualizarr/tests/test_backend.py index f922cf6..c300158 100644 --- a/virtualizarr/tests/test_backend.py +++ b/virtualizarr/tests/test_backend.py @@ -82,7 +82,7 @@ def test_no_indexes(self, netcdf4_file): def test_create_default_indexes(self, netcdf4_file): with pytest.warns(UserWarning, match="will create in-memory pandas indexes"): vds = open_virtual_dataset(netcdf4_file, indexes=None) - ds = open_dataset(netcdf4_file, decode_times=False) + ds = open_dataset(netcdf4_file, decode_times=True) # TODO use xr.testing.assert_identical(vds.indexes, ds.indexes) instead once class supported by assertion comparison, see https://github.com/pydata/xarray/issues/5812 assert index_mappings_equal(vds.xindexes, ds.xindexes) @@ -236,7 +236,7 @@ def test_loadable_variables(self, netcdf4_file): else: assert isinstance(vds[name].data, ManifestArray), name - full_ds = xr.open_dataset(netcdf4_file, decode_times=False) + full_ds = xr.open_dataset(netcdf4_file, decode_times=True) for name in full_ds.variables: if name in vars_to_load: @@ -271,10 +271,3 @@ def test_open_dataset_with_scalar(self, hdf5_scalar, tmpdir): vds = open_virtual_dataset(hdf5_scalar) assert vds.scalar.dims == () assert vds.scalar.attrs == {"scalar": "true"} - - -def test_cftime_variables_must_be_in_loadable_variables(tmpdir): - ds = xr.Dataset(data_vars={"time": ["2024-06-21"]}) - ds.to_netcdf(f"{tmpdir}/scalar.nc") - with pytest.raises(ValueError, match="'time' not in"): - open_virtual_dataset(f"{tmpdir}/scalar.nc", cftime_variables=["time"])