Skip to content

Commit 173d9f7

Browse files
committed
Simplify fmudesign tests
1 parent bc3bc1f commit 173d9f7

6 files changed

Lines changed: 419 additions & 784 deletions

File tree

tests/fmudesign/test_config_validation.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,23 @@ def test_seed_strategy_defaults_to_joint():
2020
assert cfg["seed_strategy"] is SeedStrategy.JOINT
2121

2222

23-
def test_seed_strategy_is_normalized_to_enum_member():
24-
cfg = validate_configuration(_minimal_config(seed_strategy="independent"))
25-
assert cfg["seed_strategy"] is SeedStrategy.INDEPENDENT
26-
assert cfg["seed_strategy"] == "independent"
27-
28-
29-
def test_seed_strategy_invalid_raises():
30-
with pytest.raises(ValueError, match="seed_strategy"):
31-
validate_configuration(_minimal_config(seed_strategy="bogus"))
23+
@pytest.mark.parametrize(
24+
("value", "expected"),
25+
[
26+
("independent", SeedStrategy.INDEPENDENT),
27+
("Independent", SeedStrategy.INDEPENDENT),
28+
("INDEPENDENT", SeedStrategy.INDEPENDENT),
29+
(" independent ", SeedStrategy.INDEPENDENT),
30+
(None, SeedStrategy.JOINT),
31+
("None", SeedStrategy.JOINT),
32+
],
33+
)
34+
def test_seed_strategy_is_normalized(value, expected):
35+
cfg = validate_configuration(_minimal_config(seed_strategy=value))
36+
assert cfg["seed_strategy"] is expected
3237

3338

34-
@pytest.mark.parametrize("value", [["independent"], {"joint": 1}, 5, 1.5])
35-
def test_seed_strategy_non_string_raises_value_error(value):
36-
"""Unsupported types must be rejected as validation errors, not TypeErrors."""
39+
@pytest.mark.parametrize("value", ["bogus", ["independent"], {"joint": 1}, 5, 1.5])
40+
def test_invalid_seed_strategy_raises_value_error(value):
3741
with pytest.raises(ValueError, match="seed_strategy"):
3842
validate_configuration(_minimal_config(seed_strategy=value))
39-
40-
41-
@pytest.mark.parametrize("value", ["Independent", "INDEPENDENT", " independent "])
42-
def test_seed_strategy_is_case_and_whitespace_insensitive(value):
43-
"""Excel auto-capitalizes cell text, so 'Independent' must be accepted."""
44-
cfg = validate_configuration(_minimal_config(seed_strategy=value))
45-
assert cfg["seed_strategy"] is SeedStrategy.INDEPENDENT
46-
47-
48-
@pytest.mark.parametrize("value", [None, "None"])
49-
def test_seed_strategy_none_falls_back_to_joint(value):
50-
cfg = validate_configuration(_minimal_config(seed_strategy=value))
51-
assert cfg["seed_strategy"] is SeedStrategy.JOINT

0 commit comments

Comments
 (0)