18 lines
781 B
Python
18 lines
781 B
Python
from __future__ import annotations
|
|
import pytest
|
|
from legal_mcp.services import corroboration as cor
|
|
|
|
@pytest.mark.parametrize("raw,expected", [
|
|
({"treatment": "followed"}, "followed"),
|
|
({"treatment": "OVERRULED"}, "overruled"), # case-insensitive
|
|
({"treatment": "bananas"}, "mentioned"), # unknown -> neutral default
|
|
({}, "mentioned"), # missing -> neutral default
|
|
])
|
|
def test_coerce_treatment(raw, expected):
|
|
assert cor._coerce_treatment(raw) == expected
|
|
|
|
def test_treatment_polarity():
|
|
assert cor.is_positive("followed") and cor.is_positive("explained")
|
|
assert cor.is_negative("distinguished") and cor.is_negative("overruled")
|
|
assert not cor.is_positive("mentioned") and not cor.is_negative("mentioned")
|