~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 defaults module."""
import json
from pathlib import Path
from unittest.mock import patch
import pytest
@pytest.fixture
def theme_defaults_file(tmp_path, monkeypatch):
from local_deep_research import defaults
monkeypatch.setattr(defaults, "DEFAULTS_DIR", tmp_path)
defaults.get_default_theme.cache_clear()
try:
yield tmp_path / "default_settings.json"
finally:
defaults.get_default_theme.cache_clear()
class TestDefaultTheme:
# Hashed is the chosen dark default while light themes need refinement;
# Nord verifies that the helper also reads another configured palette.
@pytest.mark.parametrize("theme", ["hashed", "nord"])
def test_reads_account_default_from_settings_file(
self, theme_defaults_file, theme
):
from local_deep_research import defaults
theme_defaults_file.write_text(
json.dumps({"app.theme": {"value": theme}}), encoding="utf-8"
)
assert defaults.get_default_theme() == theme
@pytest.mark.parametrize("theme", [None, True, 42, [], {}])
def test_rejects_non_string_defaults(self, theme_defaults_file, theme):
from local_deep_research import defaults
theme_defaults_file.write_text(
json.dumps({"app.theme": {"value": theme}}), encoding="utf-8"
)
with pytest.raises(
ValueError, match="app.theme value must be a string"
):
defaults.get_default_theme()
class TestDefaultsDir:
def test_defaults_dir_exists(self):
from local_deep_research.defaults import DEFAULTS_DIR
assert isinstance(DEFAULTS_DIR, Path)
assert DEFAULTS_DIR.exists()
class TestDefaultFiles:
def test_default_files_dict(self):
from local_deep_research.defaults import DEFAULT_FILES
assert isinstance(DEFAULT_FILES, dict)
assert len(DEFAULT_FILES) > 0
def test_main_toml_in_defaults(self):
from local_deep_research.defaults import DEFAULT_FILES
assert "main.toml" in DEFAULT_FILES
def test_search_engines_toml_in_defaults(self):
from local_deep_research.defaults import DEFAULT_FILES
assert "search_engines.toml" in DEFAULT_FILES
class TestGetDefaultFilePath:
def test_returns_path_for_known_file(self):
from local_deep_research.defaults import get_default_file_path
path = get_default_file_path("main.toml")
assert path is not None
assert isinstance(path, Path)
def test_returns_none_for_unknown_file(self):
from local_deep_research.defaults import get_default_file_path
path = get_default_file_path("nonexistent.toml")
assert path is None
class TestListDefaultFiles:
def test_returns_list(self):
from local_deep_research.defaults import list_default_files
files = list_default_files()
assert isinstance(files, list)
assert len(files) > 0
def test_contains_expected_files(self):
from local_deep_research.defaults import list_default_files
files = list_default_files()
assert "main.toml" in files
class TestEnsureDefaultsExist:
def test_returns_boolean(self):
from local_deep_research.defaults import ensure_defaults_exist
result = ensure_defaults_exist()
assert isinstance(result, bool)
def test_returns_true_when_all_exist(self):
from local_deep_research.defaults import ensure_defaults_exist
# In a properly installed package, all defaults should exist
result = ensure_defaults_exist()
# Don't assert True because some files may be missing in test env
assert result is True or result is False
def test_returns_false_when_files_missing(self):
"""Cover the 'return False' branch when files are missing."""
from local_deep_research.defaults import (
DEFAULTS_DIR,
ensure_defaults_exist,
)
fake_files = {
"nonexistent_file.toml": DEFAULTS_DIR / "does_not_exist.toml",
}
with patch.dict(
"local_deep_research.defaults.DEFAULT_FILES", fake_files, clear=True
):
result = ensure_defaults_exist()
assert result is False