~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: update integration tests to use export_report_to_memory
LearningCircuitded8dd52a3d1
diff --git a/tests/text_optimization/test_integration.py b/tests/text_optimization/test_integration.pyindex 890af51277..7a4091f930 100644--- a/tests/text_optimization/test_integration.py+++ b/tests/text_optimization/test_integration.py@@ -1,13 +1,11 @@"""Integration tests for text optimization with the research service."""import pytest-from pathlib import Path-import tempfilefrom unittest.mock import patchfrom local_deep_research.web.services.research_service import (get_citation_formatter,- export_report_to_format,+ export_report_to_memory,)from local_deep_research.text_optimization import (CitationFormatter,@@ -56,11 +54,7 @@ class TestResearchServiceIntegration:def test_export_report_to_latex(self):"""Test LaTeX export functionality."""- # Create a temporary markdown file- with tempfile.NamedTemporaryFile(- mode="w", suffix=".md", delete=False- ) as f:- f.write("""# Test Report+ markdown_content = """# Test ReportThis is a test with citation [1].@@ -68,30 +62,23 @@ This is a test with citation [1].[1] Test SourceURL: https://example.com-""")- markdown_path = Path(f.name)-- try:- # Export to LaTeX- latex_path = export_report_to_format(markdown_path, "latex")-- # Check LaTeX file was created- assert latex_path.exists()- assert latex_path.suffix == ".tex"+"""- # Check LaTeX content- with open(latex_path, "r") as f:- latex_content = f.read()+ # Export to LaTeX+ latex_bytes, filename, mimetype = export_report_to_memory(+ markdown_content, "latex", "Test Report"+ )- assert r"\documentclass[12pt]{article}" in latex_content- assert r"\section{Test Report}" in latex_content- assert r"\cite{1}" in latex_content- assert r"\bibitem{1}" in latex_content+ # Check return values+ assert filename.endswith(".tex")+ assert mimetype == "text/plain"- # Clean up- latex_path.unlink()- finally:- markdown_path.unlink()+ # Check LaTeX content+ latex_content = latex_bytes.decode("utf-8")+ assert r"\documentclass[12pt]{article}" in latex_content+ assert r"\section{Test Report}" in latex_content+ assert r"\cite{1}" in latex_content+ assert r"\bibitem{1}" in latex_content@patch("local_deep_research.config.search_config.get_setting_from_snapshot")def test_real_world_citation_formatting(self, mock_get_setting):@@ -177,11 +164,10 @@ Recent architectural innovations include:def test_export_report_to_quarto(self):"""Test Quarto export functionality."""- # Create a temporary markdown file- with tempfile.NamedTemporaryFile(- mode="w", suffix=".md", delete=False- ) as f:- f.write("""# AI Research Report+ import zipfile+ import io++ markdown_content = """# AI Research ReportThis report discusses recent advances [1] and challenges [2].@@ -191,22 +177,27 @@ This report discusses recent advances [1] and challenges [2].URL: https://arxiv.org/abs/2024.1234[2] AI ChallengesURL: https://example.com/challenges-""")- markdown_path = Path(f.name)+"""- try:- # Export to Quarto- quarto_path = export_report_to_format(- markdown_path, "quarto", "AI Research"- )+ # Export to Quarto+ zip_bytes, filename, mimetype = export_report_to_memory(+ markdown_content, "quarto", "AI Research"+ )++ # Check return values+ assert filename.endswith(".zip")+ assert mimetype == "application/zip"- # Check Quarto file was created- assert quarto_path.exists()- assert quarto_path.suffix == ".qmd"+ # Extract and check zip contents+ with zipfile.ZipFile(io.BytesIO(zip_bytes), "r") as zf:+ # Check files in zip+ files = zf.namelist()+ assert any(f.endswith(".qmd") for f in files)+ assert "references.bib" in files# Check Quarto content- with open(quarto_path, "r") as f:- quarto_content = f.read()+ qmd_file = [f for f in files if f.endswith(".qmd")][0]+ quarto_content = zf.read(qmd_file).decode("utf-8")# Verify YAML headerassert 'title: "AI Research"' in quarto_content@@ -216,35 +207,17 @@ This report discusses recent advances [1] and challenges [2].assert "[@ref1]" in quarto_contentassert "[@ref2]" in quarto_content- # Check bibliography file was created- bib_path = markdown_path.parent / "references.bib"- assert bib_path.exists()-- with open(bib_path, "r") as f:- bib_content = f.read()-+ # Check bibliography content+ bib_content = zf.read("references.bib").decode("utf-8")assert "@misc{ref1," in bib_contentassert 'title = "{Advances in AI}"' in bib_content- # Clean up- quarto_path.unlink()- bib_path.unlink()- finally:- markdown_path.unlink()-def test_export_with_invalid_format(self):"""Test export with invalid format raises error."""- with tempfile.NamedTemporaryFile(- mode="w", suffix=".md", delete=False- ) as f:- f.write("# Test")- markdown_path = Path(f.name)-- try:- with pytest.raises(ValueError, match="Unsupported export format"):- export_report_to_format(markdown_path, "invalid_format")- finally:- markdown_path.unlink()+ markdown_content = "# Test"++ with pytest.raises(ValueError, match="Unsupported export format"):+ export_report_to_memory(markdown_content, "invalid_format")@patch("local_deep_research.config.search_config.get_setting_from_snapshot")def test_automatic_export_formats(self, mock_get_setting):