Spaces:
Runtime error
Runtime error
| # tests/test_citation.py | |
| import pytest | |
| from modules.citation import CitationManager | |
| def test_add_citations(): | |
| manager = CitationManager() | |
| analysis = "This is a test finding." | |
| search_results = [ | |
| {"title": "Source A", "url": "https://a.com", "source": "Google"}, | |
| {"title": "Source B", "url": "https://b.com", "source": "Bing"}, | |
| ] | |
| result = manager.add_citations(analysis, search_results) | |
| assert isinstance(result, tuple) | |
| assert result[0] == analysis | |
| assert len(result[1]) == 2 | |
| assert "[1]" in result[1] | |
| def test_format_bibliography(): | |
| manager = CitationManager() | |
| citations = { | |
| "[1]": {"title": "Source A", "url": "https://a.com", "source": "Google"}, | |
| "[2]": {"title": "Source B", "url": "https://b.com", "source": "Bing"}, | |
| } | |
| result = manager.format_bibliography(citations) | |
| assert "Source A" in result | |
| assert "https://a.com" in result | |
| assert "Google" in result |