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.

test: delete 3 H4_ASSERTS_MOCK / H6_only_isinstance tests in diversity_explorer_coverage.py (#4285)

LearningCircuit790bce79029e
diff --git a/tests/advanced_search_system/candidate_exploration/test_diversity_explorer_coverage.py b/tests/advanced_search_system/candidate_exploration/test_diversity_explorer_coverage.py
index bfb0523fe4..db9280848c 100644
--- a/tests/advanced_search_system/candidate_exploration/test_diversity_explorer_coverage.py
+++ b/tests/advanced_search_system/candidate_exploration/test_diversity_explorer_coverage.py
@@ -106,106 +106,6 @@ class TestExploreLoop:
# Only the initial search was executed
assert mock_search.call_count == 1
- def test_underrepresented_categories_triggers_category_queries(self):
- """When underrepresented categories exist, _generate_category_queries is called."""
- explorer = _make_explorer(diversity_threshold=0.9)
-
- initial_cands = [_candidate(f"C{i}") for i in range(3)]
- call_count = {"continue": 0}
-
- def should_continue(_start, _count):
- call_count["continue"] += 1
- return call_count["continue"] <= 2
-
- with (
- patch.object(
- explorer, "_execute_search", return_value={"results": []}
- ),
- patch.object(
- explorer,
- "_extract_candidates_from_results",
- return_value=initial_cands,
- ),
- patch.object(explorer, "_categorize_candidates"),
- patch.object(
- explorer,
- "_should_continue_exploration",
- side_effect=should_continue,
- ),
- patch.object(
- explorer, "_calculate_diversity_score", return_value=0.3
- ),
- patch.object(
- explorer,
- "_find_underrepresented_categories",
- return_value=["water", "park"],
- ),
- patch.object(
- explorer, "_generate_category_queries", return_value=[]
- ) as mock_cat_queries,
- patch.object(
- explorer,
- "_final_diversity_selection",
- side_effect=lambda c: c,
- ),
- patch.object(
- explorer, "_rank_by_diversity", side_effect=lambda c, q: c
- ),
- ):
- explorer.explore("test query")
-
- mock_cat_queries.assert_called()
-
- def test_no_underrepresented_triggers_diversity_queries(self):
- """When no underrepresented categories, _generate_diversity_queries is called."""
- explorer = _make_explorer(diversity_threshold=0.9)
-
- initial_cands = [_candidate(f"C{i}") for i in range(3)]
- call_count = {"continue": 0}
-
- def should_continue(_start, _count):
- call_count["continue"] += 1
- return call_count["continue"] <= 2
-
- with (
- patch.object(
- explorer, "_execute_search", return_value={"results": []}
- ),
- patch.object(
- explorer,
- "_extract_candidates_from_results",
- return_value=initial_cands,
- ),
- patch.object(explorer, "_categorize_candidates"),
- patch.object(
- explorer,
- "_should_continue_exploration",
- side_effect=should_continue,
- ),
- patch.object(
- explorer, "_calculate_diversity_score", return_value=0.3
- ),
- patch.object(
- explorer,
- "_find_underrepresented_categories",
- return_value=[],
- ),
- patch.object(
- explorer, "_generate_diversity_queries", return_value=[]
- ) as mock_div_queries,
- patch.object(
- explorer,
- "_final_diversity_selection",
- side_effect=lambda c: c,
- ),
- patch.object(
- explorer, "_rank_by_diversity", side_effect=lambda c, q: c
- ),
- ):
- explorer.explore("test query")
-
- mock_div_queries.assert_called()
-
def test_empty_queries_breaks_loop(self):
"""When generated queries list is empty, the loop breaks."""
explorer = _make_explorer(diversity_threshold=0.99)
@@ -305,68 +205,6 @@ class TestExploreLoop:
assert mock_search.call_count == 1
- def test_should_continue_false_breaks_inner_loop(self):
- """_should_continue_exploration returning False inside for loop breaks it."""
- explorer = _make_explorer(diversity_threshold=0.99)
-
- iteration = {"count": 0}
-
- def should_continue(_start, _count):
- iteration["count"] += 1
- return iteration["count"] <= 1
-
- new_candidates = [_candidate("New1", "water")]
-
- with (
- patch.object(
- explorer, "_execute_search", return_value={"results": []}
- ),
- patch.object(
- explorer,
- "_extract_candidates_from_results",
- return_value=[],
- ),
- patch.object(explorer, "_categorize_candidates"),
- patch.object(
- explorer,
- "_should_continue_exploration",
- side_effect=should_continue,
- ),
- patch.object(
- explorer, "_calculate_diversity_score", return_value=0.1
- ),
- patch.object(
- explorer,
- "_find_underrepresented_categories",
- return_value=["water"],
- ),
- patch.object(
- explorer,
- "_generate_category_queries",
- return_value=[
- "water query1",
- "water query2",
- "water query3",
- ],
- ),
- patch.object(
- explorer,
- "_filter_for_diversity",
- return_value=new_candidates,
- ),
- patch.object(
- explorer,
- "_final_diversity_selection",
- side_effect=lambda c: c,
- ),
- patch.object(
- explorer, "_rank_by_diversity", side_effect=lambda c, q: c
- ),
- ):
- result = explorer.explore("test query")
-
- assert isinstance(result, ExplorationResult)
-
def test_explore_metadata_contains_expected_keys(self):
"""Explore result metadata has strategy, diversity score, categories, entity_type."""
explorer = _make_explorer()