feat(runtime): implement single-article consolidation runtime and modularize codebase
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""Contract tests for ecp-snapshot.schema.json and local referencing.Registry resolution."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from src.runtime.ecp.adapter import validate_ecp_snapshot
|
||||
|
||||
|
||||
def test_ecp_snapshot_schema_valid():
|
||||
sample_ecp = {
|
||||
"target_entity_id": "Q12345",
|
||||
"target_name": "Club Atlético River Plate",
|
||||
"aliases": ["River", "El Millonario", "CARP"],
|
||||
"domain": "sports",
|
||||
"anchors": ["Monumental", "Buenos Aires", "Copa Libertadores"],
|
||||
"negative_anchors": ["River Plate Uruguay"],
|
||||
"graph_version": "1.0.0",
|
||||
"related_entities": [
|
||||
{
|
||||
"entity_id": "Q54321",
|
||||
"name": "Boca Juniors",
|
||||
"relation_type": "rival",
|
||||
"weight": 0.9,
|
||||
"aliases": ["Xeneize"],
|
||||
"scope": "derby",
|
||||
"confidence": 1.0,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
validate_ecp_snapshot(sample_ecp)
|
||||
|
||||
|
||||
def test_ecp_snapshot_invalid_schema():
|
||||
invalid_ecp = {
|
||||
"target_name": "Missing target entity id",
|
||||
"domain": "sports",
|
||||
}
|
||||
with pytest.raises(ValueError, match="ECP Snapshot schema validation failed"):
|
||||
validate_ecp_snapshot(invalid_ecp)
|
||||
Reference in New Issue
Block a user