From 9a0fd2c60727779cbfe284193001bce23a246126 Mon Sep 17 00:00:00 2001 From: larsevj Date: Mon, 30 Sep 2024 12:23:48 +0200 Subject: [PATCH] Add back commit --- src/ert/config/design_matrix.py | 8 +++--- .../unit_tests/config/test_analysis_config.py | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/ert/config/design_matrix.py b/src/ert/config/design_matrix.py index 2760f42c415..e4359638384 100644 --- a/src/ert/config/design_matrix.py +++ b/src/ert/config/design_matrix.py @@ -14,8 +14,8 @@ @dataclass class DesignMatrix: xls_filename: Path - designsheet: str - defaultsheet: str + design_sheet: str + default_sheet: str @classmethod def from_config_list(cls, config_list: List[str]) -> "DesignMatrix": @@ -47,6 +47,6 @@ def from_config_list(cls, config_list: List[str]) -> "DesignMatrix": 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, ) diff --git a/tests/ert/unit_tests/config/test_analysis_config.py b/tests/ert/unit_tests/config/test_analysis_config.py index ea046b54f64..a0575e65934 100644 --- a/tests/ert/unit_tests/config/test_analysis_config.py +++ b/tests/ert/unit_tests/config/test_analysis_config.py @@ -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_matrix.txt", + "DESIGN_:design", + "DEFAULT_SHEET: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_matrix.txt", + "DESIGN_SHEET:design", + "DEFAULT_:default", + ], + } + ) + + def test_invalid_min_realization_percentage_raises_config_validation_error(): with pytest.raises( ConfigValidationError,