(inline_array)
| 104 | |
| 105 | @pytest.mark.parametrize("inline_array", [True, False]) |
| 106 | def 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 | |
| 130 | def test_top(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…