Test that FillValueCoder round-trips inf and nan fill values.
(value, dtype)
| 7266 | ], |
| 7267 | ) |
| 7268 | def test_fill_value_coder_inf_nan(value, dtype) -> None: |
| 7269 | """Test that FillValueCoder round-trips inf and nan fill values.""" |
| 7270 | from xarray.backends.zarr import FillValueCoder |
| 7271 | |
| 7272 | encoded = FillValueCoder.encode(value, np.dtype(dtype)) |
| 7273 | decoded = FillValueCoder.decode(encoded, np.dtype(dtype)) |
| 7274 | np.testing.assert_equal( |
| 7275 | np.array(decoded, dtype=dtype), np.array(value, dtype=dtype) |
| 7276 | ) |
| 7277 | |
| 7278 | |
| 7279 | @requires_zarr |