feat(corroboration): treatment classifier + polarity (INV-COR2, X11)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 18:54:50 +00:00
parent ca31932a5f
commit 09eec6a906
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
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")