(real, imag, dtype)
| 55 | dtype=st.sampled_from([np.complex64, np.complex128]), |
| 56 | ) |
| 57 | def test_FillValueCoder_complex_roundtrip(real, imag, dtype) -> None: |
| 58 | from xarray.backends.zarr import FillValueCoder |
| 59 | |
| 60 | value = dtype(complex(real, imag)) |
| 61 | encoded = FillValueCoder.encode(value, np.dtype(dtype)) |
| 62 | decoded = FillValueCoder.decode(encoded, np.dtype(dtype)) |
| 63 | np.testing.assert_equal( |
| 64 | np.array(decoded, dtype=dtype), np.array(value, dtype=dtype) |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | @given(dt=datetimes()) |