63 lines
1.7 KiB
Python
63 lines
1.7 KiB
Python
"""A suspect is a status change. Coding and care stay separate numbers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from lead.suspect import SuspectMove, suspect_move
|
|
|
|
|
|
def test_coding_and_care_stay_apart_and_reweight_shrinks_only_coding():
|
|
move = suspect_move(
|
|
before_status="standard",
|
|
after_status="high_needs",
|
|
score_before=1.0,
|
|
score_coding=1.2,
|
|
score_care=1.5,
|
|
weight_before=1.0,
|
|
weight_after=0.5,
|
|
)
|
|
assert isinstance(move, SuspectMove)
|
|
assert move.coding_delta == pytest.approx(0.2)
|
|
assert move.care_delta == pytest.approx(0.5)
|
|
assert move.coding_after_reweight == pytest.approx(0.1)
|
|
|
|
|
|
def test_the_same_status_is_not_a_suspect():
|
|
with pytest.raises(ValueError):
|
|
suspect_move(
|
|
before_status="high_needs",
|
|
after_status="high_needs",
|
|
score_before=1.0,
|
|
score_coding=1.2,
|
|
score_care=1.5,
|
|
weight_before=1.0,
|
|
weight_after=0.5,
|
|
)
|
|
|
|
|
|
def test_equal_weights_raise():
|
|
with pytest.raises(ValueError):
|
|
suspect_move(
|
|
before_status="standard",
|
|
after_status="high_needs",
|
|
score_before=1.0,
|
|
score_coding=1.2,
|
|
score_care=1.5,
|
|
weight_before=1.0,
|
|
weight_after=1.0,
|
|
)
|
|
|
|
|
|
def test_a_zero_starting_weight_raises():
|
|
with pytest.raises(ValueError):
|
|
suspect_move(
|
|
before_status="standard",
|
|
after_status="high_needs",
|
|
score_before=1.0,
|
|
score_coding=1.2,
|
|
score_care=1.5,
|
|
weight_before=0.0,
|
|
weight_after=0.5,
|
|
)
|