def test_bootstrap_replicate_1d(data, seed):
    np.random.seed(seed)
    x = dcst.bootstrap_replicate_1d(data, np.mean)
    np.random.seed(seed)
    x_correct = original.bootstrap_replicate_1d(data[~np.isnan(data)], np.mean)
    assert (np.isnan(x)
            and np.isnan(x_correct, atol=atol, equal_nan=True)) or np.isclose(
                x, x_correct, atol=atol, equal_nan=True)

    np.random.seed(seed)
    x = dcst.bootstrap_replicate_1d(data, np.median)
    np.random.seed(seed)
    x_correct = original.bootstrap_replicate_1d(data[~np.isnan(data)],
                                                np.median)
    assert (np.isnan(x)
            and np.isnan(x_correct, atol=atol, equal_nan=True)) or np.isclose(
                x, x_correct, atol=atol, equal_nan=True)

    np.random.seed(seed)
    x = dcst.bootstrap_replicate_1d(data, np.std)
    np.random.seed(seed)
    x_correct = original.bootstrap_replicate_1d(data[~np.isnan(data)], np.std)
    assert (np.isnan(x)
            and np.isnan(x_correct, atol=atol, equal_nan=True)) or np.isclose(
                x, x_correct, atol=atol, equal_nan=True)
def test_bootstrap_replicate_1d_nan():
    with pytest.raises(RuntimeError) as excinfo:
        dcst.bootstrap_replicate_1d(np.array([np.nan, np.nan]), np.mean)
    excinfo.match("Array must have at least 1 non-NaN entries.")