MCPcopy
hub / github.com/pydata/xarray / test_FillValueCoder_complex_roundtrip

Function test_FillValueCoder_complex_roundtrip

properties/test_encode_decode.py:57–65  ·  view source on GitHub ↗
(real, imag, dtype)

Source from the content-addressed store, hash-verified

55 dtype=st.sampled_from([np.complex64, np.complex128]),
56)
57def 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())

Callers

nothing calls this directly

Calls 4

dtypeFunction · 0.50
encodeMethod · 0.45
dtypeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…