Skip to content

Commit

Permalink
added test for ensemble_boot_multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszbosak committed Jul 22, 2024
1 parent 910ad8a commit c2b807c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/test_ensemble_boot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from easyvvuq.analysis.ensemble_boot import confidence_interval, bootstrap
from easyvvuq.analysis.ensemble_boot import ensemble_bootstrap, EnsembleBoot
from easyvvuq.analysis.ensemble_boot import ensemble_bootstrap, EnsembleBoot, EnsembleBootMultiple
import os
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -82,3 +82,19 @@ def test_ensemble_boot():
'b': ['group1'] * VALUES.shape[0] + ['group2'] * VALUES.shape[0]})
results = analysis.analyse(df)
assert (not results.empty)

def test_ensemble_boot_multiple():
analysis = EnsembleBootMultiple()
assert (analysis.element_name() == 'ensemble_boot_multiple')
assert (analysis.element_version() == '0.1')
with pytest.raises(RuntimeError):
analysis.analyse()
with pytest.raises(RuntimeError):
analysis.analyse(pd.DataFrame({}))
analysis = EnsembleBootMultiple(groupby=['b'], qoi_cols=['a'], stat_func=[np.mean, np.var, np.median])
df = pd.DataFrame({
'a': np.concatenate((VALUES, VALUES)),
'b': ['group1'] * VALUES.shape[0] + ['group2'] * VALUES.shape[0]})
results = analysis.analyse(df)
assert (not results.empty)
assert (results.values.shape == (2, 9))

0 comments on commit c2b807c

Please sign in to comment.