Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test: delete 13 no-assertion downloader + rag-route-coverage tests (#4282)

LearningCircuit1c3ae3338c63
diff --git a/tests/research_library/downloaders/test_biorxiv_downloader.py b/tests/research_library/downloaders/test_biorxiv_downloader.py
index 2333e75167..4af007d499 100644
--- a/tests/research_library/downloaders/test_biorxiv_downloader.py
+++ b/tests/research_library/downloaders/test_biorxiv_downloader.py
@@ -94,39 +94,10 @@ class TestBioRxivDownloaderConvertToPdfUrl:
pdf_url = downloader._convert_to_pdf_url(url)
assert pdf_url is not None
- def test_handles_non_biorxiv_url(self):
- """Should handle non-biorxiv URL (may return URL or None)."""
- downloader = BioRxivDownloader()
- # The method may return a URL or None for non-biorxiv URLs
- downloader._convert_to_pdf_url("https://example.com/paper")
- # Just verify it doesn't raise - behavior varies
-
class TestBioRxivDownloaderDownload:
"""Tests for download method."""
- def test_downloads_pdf_successfully(self, mock_pdf_content):
- """Should download PDF successfully."""
- downloader = BioRxivDownloader()
-
- # Mock the session
- mock_response = Mock()
- mock_response.status_code = 200
- mock_response.content = mock_pdf_content
- mock_response.raise_for_status = Mock()
-
- with patch.object(
- downloader.session, "get", return_value=mock_response
- ):
- with patch.object(
- downloader, "_download_pdf", return_value=mock_pdf_content
- ):
- downloader.download(
- "https://www.biorxiv.org/content/10.1101/2024.01.15.575123v1"
- )
-
- # Result depends on implementation - just verify it doesn't raise
-
def test_handles_download_failure(self):
"""Should handle download failure gracefully."""
downloader = BioRxivDownloader()
@@ -163,21 +134,6 @@ class TestBioRxivDownloaderDownload:
class TestBioRxivDownloaderDownloadWithResult:
"""Tests for download_with_result method."""
- def test_returns_download_result_structure(self, mock_pdf_content):
- """Should return DownloadResult with expected structure."""
- downloader = BioRxivDownloader()
-
- # The actual download behavior depends on network/mocking
- # Just verify the method returns a proper DownloadResult
- result = downloader.download_with_result(
- "https://www.biorxiv.org/content/10.1101/test"
- )
-
- # Should return a DownloadResult (success or failure)
- assert hasattr(result, "is_success")
- assert hasattr(result, "content")
- assert hasattr(result, "skip_reason")
-
def test_returns_skip_reason_on_failure(self):
"""Should return skip_reason when download fails."""
downloader = BioRxivDownloader()
@@ -194,33 +150,6 @@ class TestBioRxivDownloaderDownloadWithResult:
class TestBioRxivDownloaderFetchAbstract:
"""Tests for _fetch_abstract_from_page method."""
- def test_fetches_abstract_from_page(self):
- """Should fetch abstract from page HTML."""
- downloader = BioRxivDownloader()
-
- mock_response = Mock()
- mock_response.status_code = 200
- mock_response.text = """
- <html>
- <body>
- <div class="abstract">
- <p>This is the abstract content.</p>
- </div>
- </body>
- </html>
- """
- mock_response.raise_for_status = Mock()
-
- with patch.object(
- downloader.session, "get", return_value=mock_response
- ):
- downloader._fetch_abstract_from_page(
- "https://www.biorxiv.org/content/10.1101/test"
- )
-
- # Should return something (may be None if parsing fails)
- # The exact result depends on the HTML structure expected by the method
-
def test_handles_fetch_failure(self):
"""Should handle fetch failure gracefully."""
downloader = BioRxivDownloader()
diff --git a/tests/research_library/downloaders/test_semantic_scholar_downloader.py b/tests/research_library/downloaders/test_semantic_scholar_downloader.py
index da6d6fd988..c1ec29351f 100644
--- a/tests/research_library/downloaders/test_semantic_scholar_downloader.py
+++ b/tests/research_library/downloaders/test_semantic_scholar_downloader.py
@@ -58,26 +58,6 @@ class TestSemanticScholarDownloaderCanHandle:
class TestSemanticScholarDownloaderExtractPaperId:
"""Tests for _extract_paper_id method."""
- def test_extracts_paper_id_from_url(self):
- """Should extract paper ID from semantic scholar URL."""
- downloader = SemanticScholarDownloader()
- # Test with a real-format semantic scholar URL
- downloader._extract_paper_id(
- "https://www.semanticscholar.org/paper/Attention-Is-All-You-Need-Vaswani-Shazeer/204e3073870fae3d05bcbc2f6a8e263d9b72e776"
- )
- # Paper ID should be the last path component (the hash)
- # If None, the URL format may not be supported
- # Just verify method doesn't raise
-
- def test_extracts_paper_id_from_short_url(self):
- """Should extract paper ID from short URL format."""
- downloader = SemanticScholarDownloader()
- downloader._extract_paper_id(
- "https://www.semanticscholar.org/paper/abc123def456"
- )
- # May return the ID or None depending on URL format expectations
- # Just verify it doesn't raise
-
def test_returns_none_for_invalid_url(self):
"""Should return None for invalid URLs."""
downloader = SemanticScholarDownloader()
@@ -88,24 +68,6 @@ class TestSemanticScholarDownloaderExtractPaperId:
class TestSemanticScholarDownloaderGetPdfUrl:
"""Tests for _get_pdf_url method."""
- def test_returns_pdf_url_for_valid_paper(
- self, mock_semantic_scholar_paper_response
- ):
- """Should return PDF URL for valid paper."""
- downloader = SemanticScholarDownloader()
-
- mock_response = Mock()
- mock_response.status_code = 200
- mock_response.json.return_value = mock_semantic_scholar_paper_response
- mock_response.raise_for_status = Mock()
-
- with patch.object(
- downloader.session, "get", return_value=mock_response
- ):
- downloader._get_pdf_url("abc123")
-
- # May return None or a URL depending on the mock response
-
def test_returns_none_for_api_error(self):
"""Should return None when API returns error."""
downloader = SemanticScholarDownloader()
@@ -144,30 +106,6 @@ class TestSemanticScholarDownloaderGetPdfUrl:
class TestSemanticScholarDownloaderDownload:
"""Tests for download method."""
- def test_downloads_pdf_successfully(
- self, mock_pdf_content, mock_semantic_scholar_paper_response
- ):
- """Should download PDF successfully."""
- downloader = SemanticScholarDownloader()
-
- # Mock PDF response
- pdf_response = Mock()
- pdf_response.status_code = 200
- pdf_response.content = mock_pdf_content
- pdf_response.raise_for_status = Mock()
-
- with patch.object(downloader.session, "get", return_value=pdf_response):
- with patch.object(
- downloader,
- "_get_pdf_url",
- return_value="https://example.com/paper.pdf",
- ):
- downloader.download(
- "https://www.semanticscholar.org/paper/abc123"
- )
-
- # Result depends on implementation
-
def test_handles_no_pdf_available(self):
"""Should handle case when no PDF is available."""
downloader = SemanticScholarDownloader()
@@ -183,29 +121,6 @@ class TestSemanticScholarDownloaderDownload:
class TestSemanticScholarDownloaderDownloadWithResult:
"""Tests for download_with_result method."""
- def test_returns_download_result_on_success(
- self, mock_pdf_content, mock_semantic_scholar_paper_response
- ):
- """Should return DownloadResult with content on success."""
- downloader = SemanticScholarDownloader()
-
- pdf_response = Mock()
- pdf_response.status_code = 200
- pdf_response.content = mock_pdf_content
- pdf_response.raise_for_status = Mock()
-
- with patch.object(downloader.session, "get", return_value=pdf_response):
- with patch.object(
- downloader,
- "_get_pdf_url",
- return_value="https://example.com/paper.pdf",
- ):
- downloader.download_with_result(
- "https://www.semanticscholar.org/paper/abc123"
- )
-
- # Result depends on implementation
-
def test_returns_skip_reason_when_no_pdf(self):
"""Should return skip_reason when no PDF available."""
downloader = SemanticScholarDownloader()
diff --git a/tests/research_library/routes/test_rag_routes_coverage.py b/tests/research_library/routes/test_rag_routes_coverage.py
index 33fc40505e..dbdec05feb 100644
--- a/tests/research_library/routes/test_rag_routes_coverage.py
+++ b/tests/research_library/routes/test_rag_routes_coverage.py
@@ -2084,18 +2084,6 @@ class TestUpdateTaskStatus:
_update_task_status("user", "pass", "task-1", status="completed")
mock_session.commit.assert_not_called()
- def test_exception_handling(self):
- from local_deep_research.research_library.routes.rag_routes import (
- _update_task_status,
- )
-
- with patch(
- f"{_DB_CTX}.get_user_db_session",
- side_effect=RuntimeError("db error"),
- ):
- # Should not raise
- _update_task_status("user", "pass", "task-1", status="failed")
-
def test_updates_error_message(self):
from local_deep_research.research_library.routes.rag_routes import (
_update_task_status,
@@ -2191,33 +2179,6 @@ class TestIsTaskCancelled:
class TestTriggerAutoIndex:
- def test_empty_document_ids(self):
- from local_deep_research.research_library.routes.rag_routes import (
- trigger_auto_index,
- )
-
- trigger_auto_index([], "coll-1", "user", "pass")
-
- def test_auto_index_disabled(self):
- from local_deep_research.research_library.routes.rag_routes import (
- trigger_auto_index,
- )
-
- mock_sm = Mock()
- mock_sm.get_bool_setting.return_value = False
-
- mock_session = Mock()
-
- @contextmanager
- def fake_session(*a, **kw):
- yield mock_session
-
- with (
- patch(f"{_DB_CTX}.get_user_db_session", side_effect=fake_session),
- patch(f"{_ROUTES}.SettingsManager", return_value=mock_sm),
- ):
- trigger_auto_index(["doc-1"], "coll-1", "user", "pass")
-
def test_auto_index_enabled(self):
from local_deep_research.research_library.routes.rag_routes import (
trigger_auto_index,
@@ -2245,18 +2206,6 @@ class TestTriggerAutoIndex:
trigger_auto_index(["doc-1", "doc-2"], "coll-1", "user", "pass")
mock_executor.submit.assert_called_once()
- def test_settings_check_exception(self):
- from local_deep_research.research_library.routes.rag_routes import (
- trigger_auto_index,
- )
-
- with patch(
- f"{_DB_CTX}.get_user_db_session",
- side_effect=RuntimeError("db fail"),
- ):
- # Should not raise
- trigger_auto_index(["doc-1"], "coll-1", "user", "pass")
-
# ---------------------------------------------------------------------------
# Tests: get_rag_service function