diff --git a/tests/test_portfolio_construction.py b/tests/test_portfolio_construction.py index 32756d2..cd43af1 100644 --- a/tests/test_portfolio_construction.py +++ b/tests/test_portfolio_construction.py @@ -141,6 +141,16 @@ def test_weight_table_rejects_duplicate_rebalance_dates() -> None: scores_to_weight_table(scores, top_k=1) +def test_weight_table_rejects_unsorted_rebalance_dates() -> None: + scores = pd.DataFrame( + {"A": [1.0, 2.0]}, + index=pd.to_datetime(["2026-01-07", "2026-01-05"]), + ) + + with pytest.raises(ValueError, match="chronological order"): + scores_to_weight_table(scores, top_k=1) + + def test_weight_table_rejects_non_numeric_scores() -> None: scores = pd.DataFrame({"A": ["high"], "B": ["low"]})