Skip to content

Commit

Permalink
parameterize seeds used in test
Browse files Browse the repository at this point in the history
  • Loading branch information
drbenvincent committed Jan 5, 2024
1 parent db29b5b commit ee8515e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions causalpy/tests/test_pymc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,19 @@ def test_idata_property():
assert isinstance(result.idata, az.InferenceData)


def test_result_reproducibility():
seeds = [1234, 42, 123456789]


@pytest.mark.parametrize("seed", seeds)
def test_result_reproducibility(seed):
"""Test that we can reproduce the results from the model. We could in theory test
this with all the model and experiment types, but what is being targetted is
the ModelBuilder.fit method, so we should be safe testing with just one model. Here
we use the DifferenceInDifferences experiment class."""
# Load the data
df = cp.load_data("did")
# Set a random seed
sample_kwargs["random_seed"] = 42
sample_kwargs["random_seed"] = seed
# Calculate the result twice
result1 = cp.pymc_experiments.DifferenceInDifferences(
df,
Expand Down

0 comments on commit ee8515e

Please sign in to comment.