Skip to content

Commit

Permalink
Address feedback and add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 27, 2024
1 parent f4e99f8 commit f29e219
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ert/config/analysis_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class UpdateSettings:
@dataclass
class DesignMatrixArgs:
xls_filename: Path
designsheet: str
defaultsheet: str
design_sheet: str
default_sheet: str

@classmethod
def from_config_list(cls, config_list: List[str]) -> "DesignMatrixArgs":
Expand Down Expand Up @@ -69,8 +69,8 @@ def from_config_list(cls, config_list: List[str]) -> "DesignMatrixArgs":
assert default_sheet is not None
return cls(
xls_filename=filename,
designsheet=design_sheet,
defaultsheet=default_sheet,
design_sheet=design_sheet,
default_sheet=default_sheet,
)


Expand Down
26 changes: 26 additions & 0 deletions tests/ert/unit_tests/config/test_analysis_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,32 @@ def test_invalid_design_matrix_format_raises_validation_error():
)


def test_design_matrix_without_design_sheet_raises_validation_error():
with pytest.raises(ConfigValidationError, match="Missing required DESIGN_SHEET"):
_ = AnalysisConfig.from_dict(
{
ConfigKeys.DESIGN_MATRIX: [
"my_sheet.xlsx",
"DESIGN_:this_is_wrong",
"DEFAULT_SHEET:my_default",
],
}
)


def test_design_matrix_without_default_sheet_raises_validation_error():
with pytest.raises(ConfigValidationError, match="Missing required DEFAULT_SHEET"):
_ = AnalysisConfig.from_dict(
{
ConfigKeys.DESIGN_MATRIX: [
"my_sheet.xlsx",
"DESIGN_SHEET:my_design",
"DEFAULT_:this_is_wrong",
],
}
)


def test_invalid_min_realization_percentage_raises_config_validation_error():
with pytest.raises(
ConfigValidationError,
Expand Down

0 comments on commit f29e219

Please sign in to comment.