Download backend/tests/test_research_note_graph.py from Ramosh99/cognify: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/Ramosh99/cognify/resolve/main/backend/tests/test_research_note_graph.py
- Command line
-
hf download hf://spaces/Ramosh99/cognify/backend/tests/test_research_note_graph.py
-
curl -L -o test_research_note_graph.py https://huggingface.co/spaces/Ramosh99/cognify/resolve/main/backend/tests/test_research_note_graph.py
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"] | |