From 2663661be938439e8606695e051c68e3fe487f7a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 08:22:53 +0000 Subject: [PATCH] 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> --- tests/portfolio/test_config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/portfolio/test_config.py b/tests/portfolio/test_config.py index f9c4cfc8..2ad512d1 100644 --- a/tests/portfolio/test_config.py +++ b/tests/portfolio/test_config.py @@ -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)