Python · 1010 bytes Raw Blame History
1 """Tests for runtime-owned task classification helpers."""
2
3 from __future__ import annotations
4
5 from loader.runtime.task_classification import (
6 estimate_complexity,
7 get_token_budget,
8 is_conversational,
9 )
10
11
12 def test_is_conversational_detects_small_talk() -> None:
13 assert is_conversational("hi there") is True
14 assert is_conversational("thanks") is True
15 assert is_conversational("what can you do?") is True
16
17
18 def test_is_conversational_rejects_actionable_tasks() -> None:
19 assert is_conversational("create a new README for this repo") is False
20 assert is_conversational("run the tests and fix failures") is False
21
22
23 def test_estimate_complexity_and_token_budget_cover_common_paths() -> None:
24 assert estimate_complexity("hi") == "trivial"
25 assert estimate_complexity("show me the config file") == "simple"
26 assert estimate_complexity(
27 "implement a website and then refactor the database layer"
28 ) == "complex"
29 assert get_token_budget("simple") == (512, 4096)