Files
AI/ontology_platform/tests/unit/test_content_unit.py

22 lines
875 B
Python
Raw Permalink Normal View History

2026-05-19 20:31:52 +09:00
from __future__ import annotations
from pathlib import Path
from ont_platform.core.extractors.web_extractor import extract_web_content
from ont_platform.models.content_unit import PlatformContentUnit
FIXTURES = Path(__file__).resolve().parents[1] / "fixtures" / "korean"
def test_platform_content_unit_wraps_ontocast_unit_without_mutating_core() -> None:
html = (FIXTURES / "shop_coupang.html").read_text(encoding="utf-8")
extracted = extract_web_content(html=html, url="https://example.test/shop/data-quality-tool")
unit = PlatformContentUnit.from_extracted(extracted)
ontocast_unit = unit.as_ontocast()
assert unit.source_url == "https://example.test/shop/data-quality-tool"
assert unit.content_hash == extracted.content_hash
assert ontocast_unit.text == extracted.text
assert str(ontocast_unit.doc_iri).startswith("urn:source:doc_")