| 12345678910111213141516171819202122 |
- from pathlib import Path
- from app.models import AtlasAlias, AtlasEntity, AtlasIdentifier, AtlasProvenance
- from app.triple_export import entity_to_turtle
- def test_debug_turtle_can_be_written_to_file(tmp_path: Path):
- entity = AtlasEntity(
- atlas_id="atlas:mid:/m/012gx2",
- canonical_label="Joe Biden",
- entity_type="Person",
- aliases=[AtlasAlias(label="Joe Biden")],
- identifiers=[AtlasIdentifier(value="/m/012gx2", source="google", identifier_type="mid")],
- provenance=[AtlasProvenance(source="google-trends", retrieval_method="trends-resolution", confidence=0.9, retrieved_at="2026-04-03T17:33:21.651528+00:00")],
- needs_curation=False,
- )
- turtle = entity_to_turtle(entity)
- out = tmp_path / "joe_biden.ttl"
- out.write_text(turtle, encoding="utf-8")
- assert out.exists()
- assert 'atlas:canonicalLabel "Joe Biden"' in out.read_text(encoding="utf-8")
|