~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: remove 8 duplicate rejection_engine_extended tests (#4260)
LearningCircuit9a26d3562abb
diff --git a/tests/advanced_search_system/constraint_checking/test_rejection_engine_extended.py b/tests/advanced_search_system/constraint_checking/test_rejection_engine_extended.pyindex 5f35d48d99..b906f313fe 100644--- a/tests/advanced_search_system/constraint_checking/test_rejection_engine_extended.py+++ b/tests/advanced_search_system/constraint_checking/test_rejection_engine_extended.py@@ -12,8 +12,6 @@ Tests cover:These tests import and test the ACTUAL RejectionEngine class."""-from unittest.mock import patch-from local_deep_research.advanced_search_system.candidates.base_candidate import (Candidate,)@@ -341,156 +339,6 @@ class TestShouldRejectCandidate:assert "High negative evidence" in result.reason-class TestCheckAllConstraints:- """Tests for check_all_constraints method.-- Note: The Constraint dataclass is not hashable, so we test the underlying- should_reject_candidate method instead, which the check_all_constraints- method calls for each constraint.- """-- def test_multiple_constraints_all_pass(self):- """Should not reject when multiple constraints all pass via should_reject_candidate."""- engine = RejectionEngine()- candidate = Candidate(name="Test")-- constraints_and_evidence = [- (- Constraint(- id="c1",- type=ConstraintType.PROPERTY,- description="Constraint 1",- value="value1",- ),- [- ConstraintEvidence(- positive_confidence=0.8,- negative_confidence=0.1,- uncertainty=0.1,- evidence_text="text1",- source="s1",- ),- ],- ),- (- Constraint(- id="c2",- type=ConstraintType.LOCATION,- description="Constraint 2",- value="value2",- ),- [- ConstraintEvidence(- positive_confidence=0.7,- negative_confidence=0.1,- uncertainty=0.2,- evidence_text="text2",- source="s2",- ),- ],- ),- ]-- # Test each constraint individually- for constraint, evidence_list in constraints_and_evidence:- result = engine.should_reject_candidate(- candidate, constraint, evidence_list- )- assert result.should_reject is False-- def test_returns_first_rejection_via_should_reject(self):- """Should find rejection using should_reject_candidate."""- engine = RejectionEngine(positive_threshold=0.4)- candidate = Candidate(name="Test")-- constraints_and_evidence = [- (- Constraint(- id="c1",- type=ConstraintType.PROPERTY,- description="Constraint 1",- value="value1",- ),- [- ConstraintEvidence(- positive_confidence=0.8,- negative_confidence=0.1,- uncertainty=0.1,- evidence_text="text1",- source="s1",- ),- ],- ),- (- Constraint(- id="c2",- type=ConstraintType.LOCATION,- description="Constraint 2",- value="value2",- ),- [- ConstraintEvidence(- positive_confidence=0.2, # Below threshold - fails- negative_confidence=0.1,- uncertainty=0.7,- evidence_text="text2",- source="s2",- ),- ],- ),- ]-- # Check each and find first rejection- first_rejection = None- for constraint, evidence_list in constraints_and_evidence:- result = engine.should_reject_candidate(- candidate, constraint, evidence_list- )- if result.should_reject:- first_rejection = result- break-- assert first_rejection is not None- assert first_rejection.should_reject is True- assert first_rejection.constraint_value == "value2"-- def test_iterates_until_rejection(self):- """Should stop at first rejection when checking constraints sequentially."""- engine = RejectionEngine()- candidate = Candidate(name="Test")-- constraints = [- Constraint(- id=f"c{i}",- type=ConstraintType.PROPERTY,- description=f"Constraint {i}",- value=f"value{i}",- )- for i in range(3)- ]-- # All pass- rejection_found = False- for constraint in constraints:- evidence_list = [- ConstraintEvidence(- positive_confidence=0.5,- negative_confidence=0.1,- uncertainty=0.4,- evidence_text="text",- source="s",- ),- ]- result = engine.should_reject_candidate(- candidate, constraint, evidence_list- )- if result.should_reject:- rejection_found = True- break-- assert rejection_found is False--class TestThresholdBehavior:"""Tests for threshold behavior."""@@ -827,38 +675,6 @@ class TestEdgeCases:assert result.should_reject is True- def test_empty_constraint_results(self):- """Should handle empty constraint results."""- engine = RejectionEngine()- candidate = Candidate(name="Test")-- constraint_results = {}-- with patch(- "local_deep_research.advanced_search_system.constraint_checking.rejection_engine.logger"- ):- result = engine.check_all_constraints(candidate, constraint_results)-- assert result is None-- def test_constraint_with_no_evidence(self):- """Should handle constraint with no evidence."""- engine = RejectionEngine()- candidate = Candidate(name="Test")- constraint = Constraint(- id="c1",- type=ConstraintType.PROPERTY,- description="Test",- value="value",- )-- # Test using should_reject_candidate directly- result = engine.should_reject_candidate(candidate, constraint, [])-- # Empty evidence = no rejection- assert result.should_reject is False- assert result.reason == "No evidence available"-class TestCandidateLogging:"""Tests for candidate logging.@@ -927,174 +743,3 @@ class TestCandidateLogging:assert result.should_reject is Falseassert result.constraint_value == "test_constraint"assert result.reason == "Constraints satisfied"---class TestConfidenceScoreExtraction:- """Tests for confidence score extraction from evidence."""-- def test_extracts_from_evidence_correctly(self):- """Should correctly extract confidence from ConstraintEvidence."""- engine = RejectionEngine()- candidate = Candidate(name="Test")- constraint = Constraint(- id="c1",- type=ConstraintType.PROPERTY,- description="Test",- value="value",- )-- evidence = ConstraintEvidence(- positive_confidence=0.65,- negative_confidence=0.15,- uncertainty=0.2,- evidence_text="text",- source="s1",- )-- result = engine.should_reject_candidate(- candidate, constraint, [evidence]- )-- assert result.positive_confidence == 0.65- assert result.negative_confidence == 0.15---class TestMultipleConstraints:- """Tests for handling multiple constraints via sequential should_reject_candidate calls."""-- def test_checks_constraints_in_order(self):- """Should check constraints in order and find first failure."""- engine = RejectionEngine()- candidate = Candidate(name="Test")-- # First constraint passes, second fails- constraints_and_evidence = [- (- Constraint(- id="c1",- type=ConstraintType.PROPERTY,- description="C1",- value="v1",- ),- [- ConstraintEvidence(- positive_confidence=0.8,- negative_confidence=0.1,- uncertainty=0.1,- evidence_text="text1",- source="s1",- ),- ],- ),- (- Constraint(- id="c2",- type=ConstraintType.LOCATION,- description="C2",- value="v2",- ),- [- ConstraintEvidence(- positive_confidence=0.1,- negative_confidence=0.8,- uncertainty=0.1,- evidence_text="text2",- source="s2",- ),- ],- ),- ]-- # Check in order- first_rejection = None- for constraint, evidence_list in constraints_and_evidence:- result = engine.should_reject_candidate(- candidate, constraint, evidence_list- )- if result.should_reject:- first_rejection = result- break-- assert first_rejection is not None- assert first_rejection.constraint_value == "v2"-- def test_stops_on_first_rejection(self):- """Should stop checking after first rejection."""- engine = RejectionEngine()- candidate = Candidate(name="Test")-- constraints = [- Constraint(- id=f"c{i}",- type=ConstraintType.PROPERTY,- description=f"C{i}",- value=f"v{i}",- )- for i in range(5)- ]-- # Evidence list - third constraint fails- evidence_sets = [- [- ConstraintEvidence(- positive_confidence=0.8,- negative_confidence=0.1,- uncertainty=0.1,- evidence_text="t0",- source="s0",- )- ],- [- ConstraintEvidence(- positive_confidence=0.7,- negative_confidence=0.1,- uncertainty=0.2,- evidence_text="t1",- source="s1",- )- ],- [- ConstraintEvidence(- positive_confidence=0.1,- negative_confidence=0.7,- uncertainty=0.2,- evidence_text="t2",- source="s2",- )- ], # Fails- [- ConstraintEvidence(- positive_confidence=0.8,- negative_confidence=0.1,- uncertainty=0.1,- evidence_text="t3",- source="s3",- )- ],- [- ConstraintEvidence(- positive_confidence=0.9,- negative_confidence=0.05,- uncertainty=0.05,- evidence_text="t4",- source="s4",- )- ],- ]-- # Check and count how many were checked- checked_count = 0- first_rejection = None- for constraint, evidence_list in zip(constraints, evidence_sets):- checked_count += 1- result = engine.should_reject_candidate(- candidate, constraint, evidence_list- )- if result.should_reject:- first_rejection = result- break-- # Should have stopped at constraint 2 (index 2, value v2)- assert first_rejection is not None- assert first_rejection.constraint_value == "v2"- assert checked_count == 3 # Stopped after third constraint