Skip to content

Commit

Permalink
Add test that bootstrap_kwargs are passed to bootstrap call
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Oct 25, 2023
1 parent 38a506e commit c8c6032
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/estimation/test_msm_weighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,24 @@ def calc_moments(data, keys):
assert cov.shape == (3, 3)

assert cov[0, 0] > cov[1, 1] > cov[2, 2]


def test_get_moments_cov_passes_bootstrap_kwargs_to_bootstrap():
rng = get_rng(1234)
data = rng.normal(scale=[10, 5, 1], size=(100, 3))
data = pd.DataFrame(data=data)

def calc_moments(data, keys):
means = data.mean()
means.index = keys
return means.to_dict()

moment_kwargs = {"keys": ["a", "b", "c"]}

with pytest.raises(ValueError, match="a must be a positive integer unless no"):
get_moments_cov(
data=data,
calculate_moments=calc_moments,
moment_kwargs=moment_kwargs,
bootstrap_kwargs={"n_draws": -1},
)

0 comments on commit c8c6032

Please sign in to comment.