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.

1.9 KB
Raw Blame
"""Focused tests for arXiv HTML provenance catalog enum values.

These lock the exact string identifiers used by DownloadService when it
persists an HTML-extracted arXiv download. The ``extraction_method`` and
``extraction_source`` columns are unconstrained strings, so any caller
that passes the literal ``"html_extraction"`` or ``"arxiv_html"`` will
silently bypass the catalog. Giving the values first-class enum identity
in ``research_library/extraction_catalog.py`` -- rather than as new
members on ``ExtractionMethod``/``ExtractionSource`` in
``database/models/library.py`` -- keeps that catalog available without
touching a file ``test_migration_chain_integrity.py`` and
``test_upgrade_from_pre_migration_install.py`` both require to stay
byte-identical to the merge base.

The expected outcomes are:

* ``ExtractionMethodExtra.HTML_EXTRACTION.value == 'html_extraction'``
* ``ExtractionSourceExtra.ARXIV_HTML.value == 'arxiv_html'``

If either constant is renamed, the persisted strings in user databases
would drift and the existing provenance would no longer parse — which is
the regression the test guards against.
"""

from local_deep_research.research_library.extraction_catalog import (
    ExtractionMethodExtra,
    ExtractionSourceExtra,
)


class TestExtractionMethodCatalog:
    """Exact-value assertions for ``ExtractionMethodExtra``."""

    def test_html_extraction_value_is_html_extraction(self):
        assert ExtractionMethodExtra.HTML_EXTRACTION.value == "html_extraction"

    def test_html_extraction_member_exists(self):
        assert "HTML_EXTRACTION" in ExtractionMethodExtra.__members__


class TestExtractionSourceCatalog:
    """Exact-value assertions for ``ExtractionSourceExtra``."""

    def test_arxiv_html_value_is_arxiv_html(self):
        assert ExtractionSourceExtra.ARXIV_HTML.value == "arxiv_html"

    def test_arxiv_html_member_exists(self):
        assert "ARXIV_HTML" in ExtractionSourceExtra.__members__