File size: 954 Bytes
9062ca5
4a30717
9062ca5
 
 
 
 
 
 
 
 
 
 
 
 
 
4a30717
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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