Spaces:
Sleeping
Sleeping
Download libs/researchmind/tests/test_scope.py from MSGEncrypted/lesson-agent-dev: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/spaces/MSGEncrypted/lesson-agent-dev/resolve/main/libs/researchmind/tests/test_scope.py
- Command line
-
hf download hf://spaces/MSGEncrypted/lesson-agent-dev/libs/researchmind/tests/test_scope.py
-
curl -L -o test_scope.py https://huggingface.co/spaces/MSGEncrypted/lesson-agent-dev/resolve/main/libs/researchmind/tests/test_scope.py
1.2 kB
| from researchmind.scope import ( | |
| rag_scope_warning, | |
| resolve_retrieve_scope, | |
| retrieval_query, | |
| ) | |
| def test_resolve_retrieve_scope_doc_ids(): | |
| assert resolve_retrieve_scope("sess-1", ["d1", "d2"]) == (None, ["d1", "d2"]) | |
| def test_resolve_retrieve_scope_session(): | |
| assert resolve_retrieve_scope("sess-1", None) == ("sess-1", None) | |
| assert resolve_retrieve_scope("sess-1", []) == ("sess-1", None) | |
| def test_resolve_retrieve_scope_corpus(): | |
| assert resolve_retrieve_scope(None, None) == (None, None) | |
| assert resolve_retrieve_scope("", None) == (None, None) | |
| def test_retrieval_query_combines_topic(): | |
| assert retrieval_query("How does it work?", topic="Photosynthesis") == ( | |
| "Photosynthesis: How does it work?" | |
| ) | |
| def test_retrieval_query_skips_duplicate_topic(): | |
| assert retrieval_query("Explain photosynthesis", topic="Photosynthesis") == ( | |
| "Explain photosynthesis" | |
| ) | |
| def test_rag_scope_warning_messages(): | |
| assert "selected documents" in rag_scope_warning(session_id="s", doc_ids=["d"]) | |
| assert "this session" in rag_scope_warning(session_id="s", doc_ids=None) | |
| assert "corpus" in rag_scope_warning(session_id=None, doc_ids=None) | |