OffGridSchedula / tests /test_dataset.py
ParetoOptimal's picture
Initial Commit
0366d65
Raw
History Blame Contribute Delete
1.3 kB
"""The synthetic training dataset (training/make_dataset.py) stays well-formed."""
from server.schema import ActionPlan
from training.make_dataset import SEEDS, to_record
def test_enough_seeds():
assert len(SEEDS) >= 20
def test_seed_shape_and_validity():
for now, thread, plan in SEEDS:
assert isinstance(now, str) and isinstance(thread, str)
# every target plan must validate against the serving schema
ActionPlan(**plan)
def test_to_record_builds_chat_triple():
now, thread, plan = SEEDS[0]
rec = to_record(now, thread, plan)
roles = [m["role"] for m in rec["messages"]]
assert roles == ["system", "user", "assistant"]
def test_covers_hard_cases():
"""Sanity that the expansion includes empties, conflicts, clarifications, images."""
plans = [p for _, _, p in SEEDS]
assert any(p["events"] == [] for p in plans) # no-event chitchat
assert any(p["conflicts"] for p in plans) # a conflict case
assert any(p["proposed_times"] for p in plans) # alternatives offered
assert any(p.get("needs_clarification") for p in plans) # ambiguity
threads = [t for _, t, _ in SEEDS]
assert any("[image:" in t for t in threads) # image-described