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

Function test_fill_value_coder_complex

xarray/tests/test_backends.py:7246–7253  ·  view source on GitHub ↗

Test that FillValueCoder round-trips complex fill values.

(dtype)

Source from the content-addressed store, hash-verified

7244@requires_zarr
7245@pytest.mark.parametrize("dtype", [complex, np.complex64, np.complex128])
7246def test_fill_value_coder_complex(dtype) -> None:
7247 """Test that FillValueCoder round-trips complex fill values."""
7248 from xarray.backends.zarr import FillValueCoder
7249
7250 for value in [dtype(1 + 2j), dtype(-3.5 + 4.5j), dtype(complex("nan+nanj"))]:
7251 encoded = FillValueCoder.encode(value, np.dtype(dtype))
7252 decoded = FillValueCoder.decode(encoded, np.dtype(dtype))
7253 np.testing.assert_equal(np.array(decoded, dtype=dtype), np.array(value))
7254
7255
7256@requires_zarr

Callers

nothing calls this directly

Calls 4

dtypeFunction · 0.70
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…