test: add edge case for sum constraints validation
Adds an edge case test in `test_config.py` to verify that `min_cash_pct` + `max_position_pct` can be exactly `1.0` without raising a `ValueError`. Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
This commit is contained in:
parent
5799bb3f00
commit
2663661be9
|
|
@ -102,3 +102,15 @@ def test_validate_config_sum_constraints_invalid():
|
|||
}
|
||||
with pytest.raises(ValueError, match=r"must be <= 1.0"):
|
||||
validate_config(cfg)
|
||||
|
||||
def test_validate_config_sum_constraints_edge_case():
|
||||
"""min_cash_pct + max_position_pct can be exactly 1.0."""
|
||||
cfg = {
|
||||
"max_positions": 10,
|
||||
"max_position_pct": 0.5,
|
||||
"max_sector_pct": 0.3,
|
||||
"min_cash_pct": 0.5,
|
||||
"default_budget": 100000.0
|
||||
}
|
||||
# Should not raise any exception
|
||||
validate_config(cfg)
|
||||
|
|
|
|||
Loading…
Reference in New Issue