Skip to content

Commit

Permalink
assert ds errors in test_backends (#6122)
Browse files Browse the repository at this point in the history
`assert ds0 == ds2` will always evaluate to True if the datasets have at least one data variable. Instead, xr.testing.assert_equal should be used to test data variable equality.
  • Loading branch information
delgadom authored Dec 29, 2021
1 parent 6b11d6e commit 92ac89f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -5209,22 +5209,22 @@ def test_open_fsspec():
# single dataset
url = "memory://out2.zarr"
ds2 = open_dataset(url, engine="zarr")
assert ds0 == ds2
xr.testing.assert_equal(ds0, ds2)

# single dataset with caching
url = "simplecache::memory://out2.zarr"
ds2 = open_dataset(url, engine="zarr")
assert ds0 == ds2
xr.testing.assert_equal(ds0, ds2)

# multi dataset
url = "memory://out*.zarr"
ds2 = open_mfdataset(url, engine="zarr")
assert xr.concat([ds, ds0], dim="time") == ds2
xr.testing.assert_equal(xr.concat([ds, ds0], dim="time"), ds2)

# multi dataset with caching
url = "simplecache::memory://out*.zarr"
ds2 = open_mfdataset(url, engine="zarr")
assert xr.concat([ds, ds0], dim="time") == ds2
xr.testing.assert_equal(xr.concat([ds, ds0], dim="time"), ds2)


@requires_h5netcdf
Expand Down

0 comments on commit 92ac89f

Please sign in to comment.