Skip to content

Commit 1704e0f

Browse files
test: add forecast_runner v2 tests
1 parent d4730ba commit 1704e0f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

tests/test_forecast_runner_v2.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Tests for forecast_runner in epidemic-prediction-framework."""
2+
import pytest
3+
from datetime import datetime
4+
5+
6+
class TestForecastRunnerInit:
7+
def test_default_config(self):
8+
config = {"batch_size": 200, "timeout": 20}
9+
assert config["batch_size"] == 200
10+
11+
def test_initialization(self):
12+
state = {"initialized": False}
13+
state["initialized"] = True
14+
assert state["initialized"]
15+
16+
17+
class TestForecastRunnerProcessing:
18+
def test_single_item(self):
19+
item = {"id": "test-1", "value": "forecast_runner"}
20+
result = {**item, "processed_by": "forecast_runner", "version": 2}
21+
assert result["processed_by"] == "forecast_runner"
22+
23+
def test_batch(self):
24+
items = [{"id": f"item-{i}"} for i in range(10)]
25+
assert len(items) == 10
26+
27+
def test_validation_pass(self):
28+
item = {"id": "valid", "processed_by": "forecast_runner"}
29+
assert bool(item.get("id"))
30+
31+
def test_validation_fail(self):
32+
item = {}
33+
assert not bool(item.get("id"))
34+
35+
def test_metrics(self):
36+
metrics = {"runs": 2, "initialized": True}
37+
assert metrics["runs"] == 2

0 commit comments

Comments
 (0)