"""Isolated test — just fetch_citation(). Feeds it the exact claim dict extract_claims() produced in test_extract_claims_live.py, so we're chaining real output, not synthetic input. Requires S2_API_KEY set in your environment. Run from the veriscite/ root: python -m tests.test_fetch_citation_live """ import asyncio from app.graph.nodes import fetch_citation # Exact output from test_extract_claims_live.py — first claim only SAMPLE_CLAIM = { "claim": "Scientific claims spread faster than they can be verified, and " "LLMs are increasingly used to check facts against primary literature", "citation_marker": "[1]", "reference_string": "Wadden, D., Lin, S., Lo, K., Wang, L. L., van Zuylen, M., " "Cohan, A., & Hajishirzi, H. (2020). Fact or fiction: " "Verifying scientific claims. In Proceedings of EMNLP 2020.", "resolved_paper_id": None, "evidence_text": None, } async def main(): state = { "source_text": "", "claims": [SAMPLE_CLAIM], "audits": [], "current_index": 0, "report": None, } result = await fetch_citation(state) cc = result["claims"][0] print("UPDATED CLAIM CITATION:") print("resolved_paper_id:", cc["resolved_paper_id"]) print("evidence_text (first 200 chars):", (cc["evidence_text"] or "")[:200]) print() print("resolution succeeded:", cc["resolved_paper_id"] is not None) if __name__ == "__main__": asyncio.run(main())