(numel, axis, keepdims)
| 180 | @pytest.mark.parametrize("axis", [0, (0, 1), None]) |
| 181 | @pytest.mark.parametrize("keepdims", [True, False]) |
| 182 | def test_numel(numel, axis, keepdims): |
| 183 | x = np.random.random((2, 3, 4)) |
| 184 | x[x < 0.8] = 0 |
| 185 | x[x > 0.9] = np.nan |
| 186 | |
| 187 | xs = sparse.COO.from_numpy(x, fill_value=0.0) |
| 188 | |
| 189 | assert_eq( |
| 190 | numel(x, axis=axis, keepdims=keepdims), numel(xs, axis=axis, keepdims=keepdims) |
| 191 | ) |