~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
"""Parity tests for validate_setting argument handling.
Pins two contracts:
- converter metadata (setting.key, setting.ui_element) is normalized to str
before reaching get_typed_setting_value, while value/default/check_env are
passed through untouched;
- setting.options is materialized via list() before iteration.
"""
from unittest.mock import Mock, patch
def test_converter_metadata_is_stringified():
"""key/ui_element reach the converter as str; value/default/check_env do not."""
from local_deep_research.web.services.settings_service import (
validate_setting,
)
class _StrSentinel:
def __init__(self, label):
self.label = label
def __str__(self):
return "str:" + self.label
key_sentinel = _StrSentinel("key")
ui_sentinel = _StrSentinel("ui")
value_sentinel = _StrSentinel("value")
captured = {}
def recorder(**kwargs):
captured.update(kwargs)
return "typed_value"
mock_setting = Mock()
mock_setting.key = key_sentinel
mock_setting.ui_element = ui_sentinel
with patch(
"local_deep_research.web.services.settings_service.get_typed_setting_value",
side_effect=recorder,
):
is_valid, error = validate_setting(mock_setting, value_sentinel)
assert is_valid is True
assert error is None
assert captured["key"] == "str:key"
assert isinstance(captured["key"], str)
assert captured["ui_element"] == "str:ui"
assert isinstance(captured["ui_element"], str)
assert captured["value"] is value_sentinel
assert captured["default"] is None
assert captured["check_env"] is False
def test_select_options_are_materialized_with_list():
"""setting.options is passed through list() before being iterated."""
from local_deep_research.web.services.settings_service import (
validate_setting,
)
real_list = list
calls_on_spy = []
class _OptionsSpy:
def __iter__(self):
return iter([{"value": "a"}, {"value": "b"}])
options_spy = _OptionsSpy()
def tracking_list(iterable=()):
if iterable is options_spy:
calls_on_spy.append(iterable)
return real_list(iterable)
mock_setting = Mock()
mock_setting.key = "some.select.setting"
mock_setting.ui_element = "select"
mock_setting.options = options_spy
mock_setting.min_value = None
mock_setting.max_value = None
with (
patch(
"local_deep_research.web.services.settings_service.get_typed_setting_value",
return_value="a",
),
patch(
"local_deep_research.web.services.settings_service.list",
tracking_list,
create=True,
),
):
is_valid, error = validate_setting(mock_setting, "a")
assert is_valid is True
assert error is None
assert len(calls_on_spy) == 1