feat: add autonomous fiscal completion v1
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
from central.app.evidence_aggregation import Observation, aggregate_observations
|
||||
from scripts.analyze_inbound_observations import summarize_rows
|
||||
|
||||
|
||||
def test_two_suppliers_agree_without_conflict():
|
||||
rows = [
|
||||
Observation("P1", "origin", "0", "S1", "D1", "2026-01-01"),
|
||||
Observation("P1", "origin", "0", "S2", "D2", "2026-02-01"),
|
||||
]
|
||||
|
||||
result = aggregate_observations(rows)[("P1", "origin")]
|
||||
|
||||
assert result["observation_count"] == 2
|
||||
assert result["supplier_count"] == 2
|
||||
assert result["agreement_rate"] == 1.0
|
||||
assert result["strong_evidence"] is True
|
||||
assert result["conflict_count"] == 0
|
||||
|
||||
|
||||
def test_supplier_disagreement_is_conflict_not_majority():
|
||||
rows = [
|
||||
Observation("P1", "origin", "0", "S1", "D1", "2026-01-01"),
|
||||
Observation("P1", "origin", "0", "S2", "D2", "2026-02-01"),
|
||||
Observation("P1", "origin", "1", "S3", "D3", "2026-03-01"),
|
||||
]
|
||||
|
||||
result = aggregate_observations(rows)[("P1", "origin")]
|
||||
|
||||
assert result["conflict_count"] == 1
|
||||
assert result["strong_evidence"] is False
|
||||
assert result["value"] is None
|
||||
|
||||
|
||||
def test_inbound_rows_become_supplier_observations_without_raw_identity():
|
||||
result = summarize_rows([("P1", "S1", "2026-01-01", "12345678", "1102", "060")])
|
||||
|
||||
assert result["observation_count"] == 3
|
||||
assert result["sources"] == ["SUPPLIER_OBSERVATION"]
|
||||
Reference in New Issue
Block a user