Skip to content

Commit

Permalink
Force stateful test to respect finalized keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Nov 4, 2024
1 parent 2a6f544 commit 02ccc26
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions tests/ert/unit_tests/storage/test_local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,23 @@ def get_parameters(self, model_ensemble: Ensemble):
parameter_data["values"],
)

@rule(
model_ensemble=ensembles,
summary_data=summaries(
@rule(model_ensemble=ensembles, data=st.data())
def save_summary(self, model_ensemble: Ensemble, data):
storage_ensemble = self.storage.get_ensemble(model_ensemble.uuid)
storage_experiment = storage_ensemble.experiment

# Enforce the summary data to respect the
# scheme outlined in the response configs
smry_config = storage_experiment.response_configuration["summary"]

expected_summary_keys = (
st.just(smry_config.keys)
if smry_config.has_finalized_keys
else st.lists(summary_variables(), min_size=1)
)

summaries_strategy = summaries(
summary_keys=expected_summary_keys,
start_date=st.datetimes(
min_value=datetime.strptime("1969-1-1", "%Y-%m-%d"),
max_value=datetime.strptime("2010-1-1", "%Y-%m-%d"),
Expand All @@ -785,11 +799,9 @@ def get_parameters(self, model_ensemble: Ensemble):
min_size=2,
max_size=10,
),
),
)
def save_summary(self, model_ensemble: Ensemble, summary_data):
storage_ensemble = self.storage.get_ensemble(model_ensemble.uuid)
storage_experiment = storage_ensemble.experiment
)
summary_data = data.draw(summaries_strategy)

responses = storage_experiment.response_configuration.values()
summary_configs = [p for p in responses if isinstance(p, SummaryConfig)]
assume(summary_configs)
Expand Down

0 comments on commit 02ccc26

Please sign in to comment.