Skip to content

Commit

Permalink
test_access_esm1p5_config.py: Changed match case statement to if else
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeGat committed Aug 7, 2024
1 parent 3728a2a commit 6e8eb1f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/model_config_tests/qa/test_access_esm1p5_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,16 @@ def test_config_start(self, branch, config):

start: dict[str, int] = config["calendar"]["start"]

Check warning on line 120 in src/model_config_tests/qa/test_access_esm1p5_config.py

View check run for this annotation

Codecov / codecov/patch

src/model_config_tests/qa/test_access_esm1p5_config.py#L120

Added line #L120 was not covered by tests

match branch.scenario_name:
case "preindustrial":
assert start == VALID_PREINDUSTRIAL_START, error_field_incorrect(
"calendar.start", "config.yaml", VALID_PREINDUSTRIAL_START
)
case "historical":
assert start == VALID_HISTORICAL_START, error_field_incorrect(
"calendar.start", "config.yaml", VALID_HISTORICAL_START
)
case _:
pytest.fail(f"Cannot test unknown scenario {branch.scenario_name}.")
if branch.scenario_name == "preindustrial":
assert start == VALID_PREINDUSTRIAL_START, error_field_incorrect(

Check warning on line 123 in src/model_config_tests/qa/test_access_esm1p5_config.py

View check run for this annotation

Codecov / codecov/patch

src/model_config_tests/qa/test_access_esm1p5_config.py#L122-L123

Added lines #L122 - L123 were not covered by tests
"calendar.start", "config.yaml", VALID_PREINDUSTRIAL_START
)
elif branch.scenario_name == "historical":
assert start == VALID_HISTORICAL_START, error_field_incorrect(

Check warning on line 127 in src/model_config_tests/qa/test_access_esm1p5_config.py

View check run for this annotation

Codecov / codecov/patch

src/model_config_tests/qa/test_access_esm1p5_config.py#L126-L127

Added lines #L126 - L127 were not covered by tests
"calendar.start", "config.yaml", VALID_HISTORICAL_START
)
else:
pytest.fail(f"Cannot test unknown scenario {branch.scenario_name}.")

Check warning on line 131 in src/model_config_tests/qa/test_access_esm1p5_config.py

View check run for this annotation

Codecov / codecov/patch

src/model_config_tests/qa/test_access_esm1p5_config.py#L131

Added line #L131 was not covered by tests

def test_config_runtime(self, config):
assert (

Check warning on line 134 in src/model_config_tests/qa/test_access_esm1p5_config.py

View check run for this annotation

Codecov / codecov/patch

src/model_config_tests/qa/test_access_esm1p5_config.py#L134

Added line #L134 was not covered by tests
Expand Down

0 comments on commit 6e8eb1f

Please sign in to comment.