Add Forecast.actual column

This commit is contained in:
Alexander Hess 2021-01-31 18:29:53 +01:00
commit a5b590b24c
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
3 changed files with 58 additions and 0 deletions

View file

@ -18,6 +18,7 @@ def forecast(pixel):
time_step=60,
training_horizon=8,
model='hets',
actual=12,
prediction=12.3,
low80=1.23,
high80=123.4,
@ -131,6 +132,16 @@ class TestConstraints:
):
db_session.commit()
def test_non_negative_actuals(self, db_session, forecast):
"""Insert an instance with invalid data."""
forecast.actual = -1
db_session.add(forecast)
with pytest.raises(
sa_exc.IntegrityError, match='actuals_must_be_non_negative',
):
db_session.commit()
def test_set_prediction_without_ci(self, db_session, forecast):
"""Sanity check to see that the check constraint ...
@ -388,6 +399,7 @@ class TestConstraints:
time_step=forecast.time_step,
training_horizon=forecast.training_horizon,
model=forecast.model,
actual=forecast.actual,
prediction=2,
low80=1,
high80=3,