cognify / backend /tests /test_research_note_graph.py
CognifyAI CI
ci: deploy from GitHub @ 51dff8023f966a6b591f4f7c37148e9e8f55151c
789f479
Raw History Blame Contribute Delete
1.18 kB
from app.agents.research_note_graph import classify_topic_sensitivity, research_topic
def test_classifies_sensitive_health_topic():
profile = classify_topic_sensitivity("Auditory hallucinations in medical science")
assert profile["topic_domain"] == "health_science"
assert profile["sensitivity_level"] == "high"
def test_research_topic_uses_wikipedia(monkeypatch):
monkeypatch.setattr(
"app.agents.research_note_graph._wikipedia_summary",
lambda query: (
[
{
"text": "Auditory hallucinations are perceptions of sound without an external acoustic stimulus.",
"score": 1.0,
"topic": query,
"source": "Wikipedia: Auditory hallucination",
"url": "https://en.wikipedia.org/wiki/Auditory_hallucination",
"kind": "research",
}
],
None,
),
)
result = research_topic("auditory hallucinations")
assert result["sources"][0]["source"] == "Wikipedia: Auditory hallucination"
assert "Auditory hallucinations" in result["sources"][0]["text"]