~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
"""Tests for ``_extract_domain()`` in ``web/routers/metrics.py``.
Ported from ``tests/web/routes/test_extract_domain.py`` (deleted by the
FastAPI migration). The helper moved verbatim from
``web/routes/metrics_routes.py`` to ``web/routers/metrics.py``; nothing on
the branch pinned it, so URL parsing, ``www.`` stripping, lowercasing and
the defensive error handling are re-pinned here.
"""
from local_deep_research.web.routers.metrics import _extract_domain
class TestExtractDomain:
"""Tests for _extract_domain()."""
def test_normal_https_url(self):
assert _extract_domain("https://example.com/path") == "example.com"
def test_strips_www_prefix(self):
assert _extract_domain("https://www.example.com") == "example.com"
def test_lowercases_domain(self):
assert _extract_domain("https://EXAMPLE.COM") == "example.com"
def test_url_with_port(self):
assert (
_extract_domain("https://example.com:8080/path")
== "example.com:8080"
)
def test_empty_string_returns_none(self):
assert _extract_domain("") is None
def test_none_input_returns_none(self):
"""None input should be handled defensively like other invalid URLs."""
assert _extract_domain(None) is None
def test_path_only_no_netloc_returns_none(self):
assert _extract_domain("/just/a/path") is None
def test_subdomain_preserved(self):
assert _extract_domain("https://api.example.com") == "api.example.com"