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

Function test_decode_unsigned_from_signed

xarray/tests/test_coding.py:125–135  ·  view source on GitHub ↗
(bits)

Source from the content-addressed store, hash-verified

123
124@pytest.mark.parametrize("bits", [1, 2, 4, 8])
125def test_decode_unsigned_from_signed(bits) -> None:
126 unsigned_dtype = np.dtype(f"u{bits}")
127 signed_dtype = np.dtype(f"i{bits}")
128 original_values = np.array([np.iinfo(unsigned_dtype).max], dtype=unsigned_dtype)
129 encoded = xr.Variable(
130 ("x",), original_values.astype(signed_dtype), attrs={"_Unsigned": "true"}
131 )
132 coder = variables.CFMaskCoder()
133 decoded = coder.decode(encoded)
134 assert decoded.dtype == unsigned_dtype
135 assert decoded.values == original_values
136
137
138@pytest.mark.parametrize("bits", [1, 2, 4, 8])

Callers

nothing calls this directly

Calls 3

decodeMethod · 0.95
dtypeMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…