MCPcopy Index your code
hub / github.com/pydata/xarray / test_EncodedStringCoder_decode_dask

Function test_EncodedStringCoder_decode_dask

xarray/tests/test_coding_strings.py:72–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71@requires_dask
72def test_EncodedStringCoder_decode_dask() -> None:
73 coder = strings.EncodedStringCoder()
74
75 raw_data = np.array([b"abc", "ß∂µ∆".encode()])
76 raw = Variable(("x",), raw_data, {"_Encoding": "utf-8"}).chunk()
77 actual = coder.decode(raw)
78 assert isinstance(actual.data, da.Array)
79
80 expected = Variable(("x",), np.array(["abc", "ß∂µ∆"], dtype=object))
81 assert_identical(actual, expected)
82
83 actual_indexed = coder.decode(actual[0])
84 assert isinstance(actual_indexed.data, da.Array)
85 assert_identical(actual_indexed, expected[0])
86
87
88def test_EncodedStringCoder_encode() -> None:

Callers

nothing calls this directly

Calls 5

decodeMethod · 0.95
VariableClass · 0.90
assert_identicalFunction · 0.90
encodeMethod · 0.45
chunkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…