File size: 1,699 Bytes
dd8acc2 | 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 51 52 53 54 55 | """Tests for src.fusion.clinical — per-test signal normalisers.
Convention: signal in [-1, 1] where +1 = strong evidence the disease IS
present and -1 = strong evidence it is NOT present.
"""
from __future__ import annotations
import pytest
from src.fusion import clinical
class TestMMSE:
def test_perfect_score_signals_no_alzheimers(self) -> None:
assert clinical.mmse_to_signal(30.0) == pytest.approx(-1.0)
def test_severely_impaired_signals_alzheimers(self) -> None:
assert clinical.mmse_to_signal(0.0) == pytest.approx(1.0)
def test_borderline_24_is_near_neutral_slightly_positive(self) -> None:
sig = clinical.mmse_to_signal(24.0)
assert -0.1 < sig < 0.5
class TestMoCA:
def test_perfect_signals_negative(self) -> None:
assert clinical.moca_to_signal(30.0) == pytest.approx(-1.0)
def test_zero_signals_positive(self) -> None:
assert clinical.moca_to_signal(0.0) == pytest.approx(1.0)
class TestUPDRS:
def test_zero_signals_no_parkinsons(self) -> None:
assert clinical.updrs_to_signal(0.0) == pytest.approx(-1.0)
def test_max_signals_parkinsons(self) -> None:
assert clinical.updrs_to_signal(199.0) == pytest.approx(1.0, abs=1e-3)
class TestGait:
def test_fast_walker_signals_negative(self) -> None:
assert clinical.gait_to_signal(1.4) < -0.4
def test_slow_walker_signals_positive(self) -> None:
assert clinical.gait_to_signal(0.3) > 0.4
class TestAge:
def test_young_signals_negative(self) -> None:
assert clinical.age_to_signal(30.0) < -0.4
def test_elderly_signals_positive(self) -> None:
assert clinical.age_to_signal(85.0) > 0.4
|