from pathlib import Path from app.models import AtlasAlias, AtlasClaim, AtlasClaimObject, AtlasEntity, 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:012gx2abcd123456", canonical_label="Joe Biden", entity_type="Person", aliases=[AtlasAlias(label="Joe Biden")], claims=[ AtlasClaim( claim_id="clm_raw_ident_mid_/m/012gx2", subject="atlas:012gx2abcd123456", predicate="atlas:hasIdentifier", object=AtlasClaimObject(kind="identifier", id_type="mid", value="/m/012gx2"), layer="raw", 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")