Skip to content

Commit

Permalink
removed test_cftime_variables_must_be_in_loadable_variables test & up…
Browse files Browse the repository at this point in the history
…dated xr.open_dataset decode behavior
  • Loading branch information
norlandrhagen committed Aug 27, 2024
1 parent 3380a86 commit d0c1c13
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions virtualizarr/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"])

0 comments on commit d0c1c13

Please sign in to comment.