ducklm/tests/test_contracts.py

38 lines
876 B
Python

from app.core.contracts import CriticScore, ExecutionDirective, PlanStep, UserTask
def test_user_task_defaults() -> None:
task = UserTask(input="hello")
assert task.task_id
assert task.session_id
def test_plan_step_supports_dependencies() -> None:
step = PlanStep(
id="step-1",
kind="tool",
tool="shell_exec",
description="run command",
depends_on=[],
)
assert step.tool == "shell_exec"
def test_critic_score_bounds() -> None:
score = CriticScore(
correctness=1.0,
usefulness=0.5,
safety=0.0,
memory_store=False,
weight=0.2,
explanation="ok",
)
assert score.weight == 0.2
def test_execution_directive_defaults() -> None:
directive = ExecutionDirective(type="noop")
assert directive.payload == {}
assert directive.confidence == 0.0