MCPcopy Create free account
hub / github.com/dask/dask / test_graph_from_arraylike

Function test_graph_from_arraylike

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

Source from the content-addressed store, hash-verified

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