(func)
| 77 | |
| 78 | @pytest.mark.parametrize("func", functions) |
| 79 | def test_basic(func): |
| 80 | x = da.random.random((2, 3, 4), chunks=(1, 2, 2)) |
| 81 | x[x < 0.8] = 0 |
| 82 | |
| 83 | y = x.map_blocks(sparse.COO.from_numpy) |
| 84 | |
| 85 | xx = func(x) |
| 86 | yy = func(y) |
| 87 | |
| 88 | assert_eq(xx, yy, check_meta=False) |
| 89 | |
| 90 | if yy.shape: |
| 91 | zz = yy.compute() |
| 92 | if not isinstance(zz, sparse.COO): |
| 93 | assert (zz != 1).sum() > np.prod(zz.shape) / 2 # mostly dense |
| 94 | |
| 95 | |
| 96 | def test_tensordot(): |