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

Function test_char_to_bytes_dask

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

Source from the content-addressed store, hash-verified

274
275@requires_dask
276def test_char_to_bytes_dask() -> None:
277 numpy_array = np.array([[b"a", b"b", b"c"], [b"d", b"e", b"f"]])
278 array = da.from_array(numpy_array, ((2,), (3,)))
279 expected = np.array([b"abc", b"def"])
280 actual = strings.char_to_bytes(array)
281 assert isinstance(actual, da.Array)
282 assert actual.chunks == ((2,),)
283 assert actual.dtype == "S3"
284 assert_array_equal(np.array(actual), expected)
285
286 with pytest.raises(ValueError, match=r"stacked dask character array"):
287 strings.char_to_bytes(array.rechunk(1))
288
289
290def test_bytes_to_char() -> None:

Callers

nothing calls this directly

Calls 2

from_arrayMethod · 0.45
rechunkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…