Exemplo n.º 1
0
def gen_sparse_random_nan_reduction(draw, shapes, **kwargs):
    fraction = draw(st.sampled_from([0.25, 0.5, 0.75, 1.0]))
    return sparse.random(
        shapes, data_rvs=random_value_array(np.nan, fraction), **kwargs
    )
Exemplo n.º 2
0
def test_all_nan_reduction_warning(reduction, axis):
    x = random_value_array(np.nan, 1.0)(2 * 3 * 4).reshape(2, 3, 4)
    s = COO.from_numpy(x)

    with pytest.warns(RuntimeWarning):
        getattr(sparse, reduction)(s, axis=axis)