diff --git a/tests/test_portfolio_construction.py b/tests/test_portfolio_construction.py index 43cd606..32756d2 100644 --- a/tests/test_portfolio_construction.py +++ b/tests/test_portfolio_construction.py @@ -130,6 +130,17 @@ def test_portfolio_construction_rejects_duplicate_assets() -> None: scores_to_target_weights(duplicate_scores, top_k=1) +def test_weight_table_rejects_duplicate_rebalance_dates() -> None: + duplicate_date = pd.Timestamp("2026-01-05") + scores = pd.DataFrame( + {"A": [1.0, 2.0]}, + index=[duplicate_date, duplicate_date], + ) + + with pytest.raises(ValueError, match="unique rebalance dates"): + scores_to_weight_table(scores, top_k=1) + + def test_weight_table_rejects_non_numeric_scores() -> None: scores = pd.DataFrame({"A": ["high"], "B": ["low"]})