-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_scoring.py
More file actions
50 lines (37 loc) · 1.31 KB
/
Copy pathtest_scoring.py
File metadata and controls
50 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from datetime import date, timedelta
from engine.core.models import ProfileConfig, Task
from engine.core.scoring import score_tasks
def test_higher_importance_scores_higher():
profile = ProfileConfig(name="test_profile")
low = Task(id="low", title="Low importance", importance=1, urgency=3)
high = Task(id="high", title="High importance", importance=5, urgency=3)
scored = score_tasks([low, high], profile)
assert scored[0].task.id == "high"
def test_nearer_deadline_scores_higher_when_other_fields_match():
profile = ProfileConfig(name="test_profile")
due_today = Task(
id="today",
title="Due today",
due_date=date.today(),
stress_impact="LOW",
)
due_later = Task(
id="later",
title="Due later",
due_date=date.today() + timedelta(days=14),
stress_impact="LOW",
)
scored = score_tasks([due_later, due_today], profile)
assert scored[0].task.id == "today"
def test_score_includes_inspectable_breakdown():
profile = ProfileConfig(name="test_profile")
task = Task(id="task", title="Task")
result = score_tasks([task], profile)[0]
assert set(result.breakdown) == {
"importance_n",
"urgency_n",
"effort_n",
"deadline_n",
"stress_penalty",
"base_score",
}