~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
test: delete 3 Tier-3 shadow / script-style test files (#4270)
LearningCircuit0c3607329096
diff --git a/tests/fix_tests/test_duplicate_links_fix.py b/tests/fix_tests/test_duplicate_links_fix.pydeleted file mode 100644index 585667d6ae..0000000000--- a/tests/fix_tests/test_duplicate_links_fix.py+++ /dev/null@@ -1,122 +0,0 @@-"""-Test script to demonstrate the duplicate links issue and our fix for issue #301.--This test demonstrates the problem where the search system duplicates links in detailed report mode-by unconditionally extending the all_links_of_system list with itself.--GitHub issue: https://github.com/LearningCircuit/local-deep-research/issues/301--The fix is to check if the lists are the same object (have the same id()) before extending.-"""---class Strategy:- def __init__(self, all_links=None):- # Create a new list if None is provided- self.all_links_of_system = [] if all_links is None else all_links- print(- f"Strategy initialized with list id: {id(self.all_links_of_system)}"- )-- def analyze_topic(self, query):- # Add some links- self.all_links_of_system.extend(- [- {"title": "Link 1", "link": "http://example.com/1"},- {"title": "Link 2", "link": "http://example.com/2"},- ]- )- print(f"Strategy now has {len(self.all_links_of_system)} links")- return {"content": "Analysis results"}---class AdvancedSearchSystem:- def __init__(self):- # Initialize with empty list- self.all_links_of_system = []- print(- f"Search system initialized with list id: {id(self.all_links_of_system)}"- )-- # Create strategy with our list reference- self.strategy = Strategy(all_links=self.all_links_of_system)-- # Check if they're the same object- print(- f"Are lists the same object? {id(self.all_links_of_system) == id(self.strategy.all_links_of_system)}"- )-- def analyze_topic_with_bug(self, query):- # Run the strategy- result = self.strategy.analyze_topic(query)-- # BUG: Unconditionally extend our list with the strategy's list- # This is problematic because they're the same list- print("\nBUG DEMO: Extending unconditionally")- before_count = len(self.all_links_of_system)- print(f"Before extending: {before_count} links")-- self.all_links_of_system.extend(self.strategy.all_links_of_system)-- after_count = len(self.all_links_of_system)- print(f"After extending: {after_count} links")- print(f"Added {after_count - before_count} links (duplicates)")-- # Return results- return {- "all_links_of_system": self.all_links_of_system,- "content": result["content"],- }-- def analyze_topic_with_fix(self, query):- # Run the strategy- result = self.strategy.analyze_topic(query)-- # FIX: Only extend if they're different objects- print("\nFIX DEMO: Only extending if lists are different")- before_count = len(self.all_links_of_system)- print(f"Before fix check: {before_count} links")-- if id(self.all_links_of_system) != id(- self.strategy.all_links_of_system- ):- print("Lists are different objects - extending")- self.all_links_of_system.extend(self.strategy.all_links_of_system)- else:- print(- "Lists are the same object - not extending (avoiding duplicates)"- )-- after_count = len(self.all_links_of_system)- print(f"After fix check: {after_count} links")- print(f"Added {after_count - before_count} links")-- # Return results- return {- "all_links_of_system": self.all_links_of_system,- "content": result["content"],- }---def test_bug_and_fix():- print("=== Testing Bug and Fix ===\n")-- print("1. Creating first search system to demonstrate the bug:")- search_system1 = AdvancedSearchSystem()- result1 = search_system1.analyze_topic_with_bug(- "What is quantum computing?"- )- print(f"\nFinal link count with bug: {len(result1['all_links_of_system'])}")-- print("\n2. Creating second search system to demonstrate the fix:")- search_system2 = AdvancedSearchSystem()- result2 = search_system2.analyze_topic_with_fix(- "What is quantum computing?"- )- print(f"\nFinal link count with fix: {len(result2['all_links_of_system'])}")-- print("\nTest complete!")---if __name__ == "__main__":- test_bug_and_fix()diff --git a/tests/text_processing/test_text_cleaner_exception_path.py b/tests/text_processing/test_text_cleaner_exception_path.pydeleted file mode 100644index eeadbc0d8a..0000000000--- a/tests/text_processing/test_text_cleaner_exception_path.py+++ /dev/null@@ -1,51 +0,0 @@-"""Tests for text_cleaner exception/fallback path (lines 32-39).--The exception branch in remove_surrogates is triggered when the-surrogatepass encode/decode raises an unexpected exception (not the normal-UnicodeEncodeError that surrogatepass handles). We test this by monkeypatching-the module-level function to inject failures.-"""---class TestRemoveSurrogatesExceptionFallback:- """Cover the exception branch that falls back to encode/decode with ignore."""-- def test_exception_in_encode_triggers_fallback(self):- """When the primary encode().decode() chain raises, fallback is used."""- # We can't patch str.encode, but we can patch the function itself- # to verify the fallback path works by calling it with a specially- # crafted object that triggers the except branch.-- # Create a string subclass that raises on surrogatepass- class BadString(str):- def encode(self, encoding="utf-8", errors="strict"):- if errors == "surrogatepass":- raise RuntimeError("Simulated surrogatepass failure")- return super().encode(encoding, errors=errors)-- # Directly test the exception path logic- text = BadString("Hello World")- try:- result = text.encode("utf-8", errors="surrogatepass").decode(- "utf-8", errors="replace"- )- except Exception:- # This is the fallback path- result = text.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )-- assert result == "Hello World"-- def test_fallback_produces_valid_utf8(self):- """The ignore-errors fallback produces valid UTF-8."""- # Simulate the fallback path directly- text_with_surrogate = "Hello\ud800World"- # The fallback path:- result = text_with_surrogate.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )- assert isinstance(result, str)- result.encode("utf-8") # Should not raise- assert "Hello" in result- assert "World" in resultdiff --git a/tests/text_processing/test_text_cleaner_fallback_coverage.py b/tests/text_processing/test_text_cleaner_fallback_coverage.pydeleted file mode 100644index cc62143a1f..0000000000--- a/tests/text_processing/test_text_cleaner_fallback_coverage.py+++ /dev/null@@ -1,93 +0,0 @@-"""-Tests for the exception fallback path in text_cleaner.remove_surrogates (lines 32-37).--The fallback is triggered when the primary encode("utf-8", errors="surrogatepass")-chain raises an unexpected exception. Since str.encode is a C method and can't be-patched, we replace remove_surrogates temporarily with a version that forces the-exception path.-"""--from unittest.mock import patch--import local_deep_research.text_processing.text_cleaner as cleaner_module---class TestRemoveSurrogatesFallback:- """Cover the except branch (lines 32-37) in remove_surrogates."""-- def test_fallback_produces_valid_output(self):- """Exercise the except branch by replacing the function with one that- always takes the fallback path, then verify the output is correct."""- # Directly exercise the fallback logic (lines 36-38)- text = "Hello World"- result = text.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )- assert result == "Hello World"-- def test_fallback_path_via_module_replacement(self):- """Replace remove_surrogates with a version that forces the except path."""-- def remove_surrogates_forced_fallback(text):- """Version of remove_surrogates that always hits the except branch."""- from loguru import logger-- if not text:- return text- try:- raise RuntimeError("Forced failure for coverage")- except Exception as e:- logger.warning(- f"Error cleaning text with surrogatepass: {e}, using fallback"- )- return text.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )-- original = cleaner_module.remove_surrogates- cleaner_module.remove_surrogates = remove_surrogates_forced_fallback- try:- result = cleaner_module.remove_surrogates("test text")- assert result == "test text"- finally:- cleaner_module.remove_surrogates = original-- def test_fallback_with_surrogates_in_string(self):- """Test the fallback encoding behavior with actual surrogate chars."""- # Surrogates like \ud800 can cause issues- text_with_surrogate = "Hello\ud800World"- # The fallback path: encode with ignore strips the surrogate- result = text_with_surrogate.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )- assert "Hello" in result- assert "World" in result- # Should be valid UTF-8- result.encode("utf-8")-- def test_exception_handler_logs_warning(self):- """Verify the logger.warning call in the except block."""- with patch.object(cleaner_module, "logger") as mock_logger:- # Create a version that always hits the except path- def forced_fallback(text):- if not text:- return text- try:- raise RuntimeError("test error")- except Exception as e:- mock_logger.warning(- f"Error cleaning text with surrogatepass: {e}, using fallback"- )- return text.encode("utf-8", errors="ignore").decode(- "utf-8", errors="ignore"- )-- original = cleaner_module.remove_surrogates- cleaner_module.remove_surrogates = forced_fallback- try:- result = cleaner_module.remove_surrogates("hello")- assert result == "hello"- mock_logger.warning.assert_called_once()- assert "test error" in str(mock_logger.warning.call_args)- finally:- cleaner_module.remove_surrogates = original