From 0e5d202618baf7cf850128872a1198e7edb76f53 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sun, 21 Jan 2024 16:24:42 -0800 Subject: [PATCH] Silence deprecation warning from `.dims` in tests --- xarray/tests/test_dataset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py index 664d108b89c..fa9448f2f41 100644 --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -698,7 +698,11 @@ def test_properties(self) -> None: # TODO change after deprecation cycle in GH #8500 is complete assert isinstance(ds.dims.mapping, dict) assert type(ds.dims.mapping) is dict # noqa: E721 - assert ds.dims == ds.sizes + with pytest.warns( + FutureWarning, + match=" To access a mapping from dimension names to lengths, please use `Dataset.sizes`", + ): + assert ds.dims == ds.sizes assert ds.sizes == {"dim1": 8, "dim2": 9, "dim3": 10, "time": 20} # dtypes