Skip to content

Commit 5bd3d8b

Browse files
authored
Silence deprecation warning from .dims in tests (#8639)
1 parent 32c1645 commit 5bd3d8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

xarray/tests/test_dataset.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,11 @@ def test_properties(self) -> None:
698698
# TODO change after deprecation cycle in GH #8500 is complete
699699
assert isinstance(ds.dims.mapping, dict)
700700
assert type(ds.dims.mapping) is dict # noqa: E721
701-
assert ds.dims == ds.sizes
701+
with pytest.warns(
702+
FutureWarning,
703+
match=" To access a mapping from dimension names to lengths, please use `Dataset.sizes`",
704+
):
705+
assert ds.dims == ds.sizes
702706
assert ds.sizes == {"dim1": 8, "dim2": 9, "dim3": 10, "time": 20}
703707

704708
# dtypes

0 commit comments

Comments
 (0)