test_debug_export_file.py 925 B

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