MCPcopy Index your code
hub / github.com/dask/dask / test_graph_from_arraylike

Function test_graph_from_arraylike

dask/array/tests/test_array_core.py:106–127  ·  view source on GitHub ↗
(inline_array)

Source from the content-addressed store, hash-verified

104
105@pytest.mark.parametrize("inline_array", [True, False])
106def test_graph_from_arraylike(inline_array):
107 d = 2
108 chunk = (2, 3)
109 shape = tuple(d * n for n in chunk)
110 arr = np.ones(shape)
111
112 dsk = graph_from_arraylike(
113 arr, chunk, shape=shape, name="X", inline_array=inline_array
114 )
115
116 assert isinstance(dsk, HighLevelGraph)
117 if inline_array:
118 assert len(dsk.layers) == 1
119 assert isinstance(hlg_layer_topological(dsk, 0), Blockwise)
120 else:
121 assert len(dsk.layers) == 2
122 assert isinstance(hlg_layer_topological(dsk, 0), MaterializedLayer)
123 assert isinstance(hlg_layer_topological(dsk, 1), Blockwise)
124 dsk = dict(dsk)
125
126 # Somewhat odd membership check to avoid numpy elemwise __in__ overload
127 assert any(arr is v for v in dsk.values()) is not inline_array
128
129
130def test_top():

Callers

nothing calls this directly

Calls 5

graph_from_arraylikeFunction · 0.90
hlg_layer_topologicalFunction · 0.90
anyFunction · 0.85
onesMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…