Skip to content

Commit e8cdfc2

Browse files
committed
add test for short series error with Prophet in detect_anomalies
1 parent 4af3f43 commit e8cdfc2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/models/utils/test_forecaster.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33
from utilsforecast.data import generate_series
44

5+
from timecopilot.models.prophet import Prophet
56
from timecopilot.models.stats import SeasonalNaive
67
from timecopilot.models.utils.forecaster import (
78
QuantileConverter,
@@ -332,3 +333,16 @@ def test_detect_anomalies_short_series_error():
332333
)
333334
with pytest.raises(ValueError, match="Cannot perform anomaly detection"):
334335
model.detect_anomalies(df, h=5, freq="D")
336+
337+
338+
def test_prophet_detect_anomalies_short_series_error():
339+
model = Prophet()
340+
df = pd.DataFrame(
341+
{
342+
"unique_id": ["A", "A"],
343+
"ds": pd.date_range("2023-01-01", periods=2, freq="D"),
344+
"y": [1.0, 2.0],
345+
}
346+
)
347+
with pytest.raises(ValueError, match="Cannot perform anomaly detection"):
348+
model.detect_anomalies(df, h=1, freq="D")

0 commit comments

Comments
 (0)