diff --git a/xarray/coding/variables.py b/xarray/coding/variables.py index 3b7be898ccf..eff08c74500 100644 --- a/xarray/coding/variables.py +++ b/xarray/coding/variables.py @@ -164,10 +164,8 @@ def _check_fill_values(attrs, name, dtype): Issue SerializationWarning if appropriate. """ raw_fill_dict = {} - [ + for attr in ("missing_value", "_FillValue"): pop_to(attrs, raw_fill_dict, attr, name=name) - for attr in ("missing_value", "_FillValue") - ] encoded_fill_values = set() for k in list(raw_fill_dict): v = raw_fill_dict[k] @@ -376,11 +374,9 @@ def decode(self, variable: Variable, name: T_Name = None): dims, data, attrs, encoding = unpack_for_decoding(variable) - # Even if _Unsigned is use, retain on-disk _FillValue - [ + # Even if _Unsigned is used, retain on-disk _FillValue + for attr, value in raw_fill_dict.items(): safe_setitem(encoding, attr, value, name=name) - for attr, value in raw_fill_dict.items() - ] if "_Unsigned" in attrs: unsigned = pop_to(attrs, encoding, "_Unsigned") diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index ccb832ee522..9024f2ae677 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -1129,7 +1129,8 @@ def test_unify_chunks(map_ds): def test_unify_chunks_shallow_copy(obj, transform): obj = transform(obj) unified = obj.unify_chunks() - assert_identical(obj, unified) and obj is not obj.unify_chunks() + assert_identical(obj, unified) + # assert obj is not unified @pytest.mark.parametrize("obj", [make_da()])