7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
114 lines
3.4 KiB
Python
114 lines
3.4 KiB
Python
"""
|
|
Tests for base class concrete methods in the advanced_search_system.
|
|
|
|
Each test class creates a minimal concrete subclass that inherits from the ABC,
|
|
implements abstract methods as no-ops, then exercises the concrete helper methods.
|
|
"""
|
|
|
|
from unittest.mock import Mock
|
|
|
|
from local_deep_research.advanced_search_system.findings.base_findings import (
|
|
BaseFindingsRepository,
|
|
)
|
|
from local_deep_research.advanced_search_system.questions.base_question import (
|
|
BaseQuestionGenerator,
|
|
)
|
|
from local_deep_research.advanced_search_system.questions.followup.base_followup_question import (
|
|
BaseFollowUpQuestionGenerator,
|
|
)
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Minimal concrete subclasses
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
class ConcreteQuestionGenerator(BaseQuestionGenerator):
|
|
def generate_questions(
|
|
self,
|
|
current_knowledge,
|
|
query,
|
|
questions_per_iteration,
|
|
questions_by_iteration,
|
|
):
|
|
return []
|
|
|
|
|
|
class ConcreteFollowUpQuestionGenerator(BaseFollowUpQuestionGenerator):
|
|
def generate_contextualized_query(
|
|
self, follow_up_query, original_query, past_findings, **kwargs
|
|
):
|
|
return ""
|
|
|
|
|
|
class ConcreteFindingsRepository(BaseFindingsRepository):
|
|
def add_finding(self, query, finding):
|
|
pass
|
|
|
|
def get_findings(self, query):
|
|
return []
|
|
|
|
def clear_findings(self, query):
|
|
pass
|
|
|
|
def synthesize_findings(
|
|
self, query, sub_queries, findings, accumulated_knowledge
|
|
):
|
|
return ""
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Tests
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
class TestBaseQuestionGenerator:
|
|
def setup_method(self):
|
|
self.gen = ConcreteQuestionGenerator(model=Mock())
|
|
|
|
def test_format_previous_questions(self):
|
|
questions_by_iteration = {
|
|
1: ["What is X?", "What is Y?"],
|
|
2: ["How does Z work?"],
|
|
}
|
|
result = self.gen._format_previous_questions(questions_by_iteration)
|
|
assert "Iteration 1:" in result
|
|
assert "- What is X?" in result
|
|
assert "- What is Y?" in result
|
|
assert "Iteration 2:" in result
|
|
assert "- How does Z work?" in result
|
|
|
|
def test_format_previous_questions_empty(self):
|
|
result = self.gen._format_previous_questions({})
|
|
assert result == ""
|
|
|
|
|
|
class TestBaseFollowUpQuestionGenerator:
|
|
def setup_method(self):
|
|
self.gen = ConcreteFollowUpQuestionGenerator(model=Mock())
|
|
|
|
def test_init_sets_empty_context(self):
|
|
assert self.gen.follow_up_context == {}
|
|
|
|
def test_set_follow_up_context(self):
|
|
ctx = {"past_findings": "some findings", "original_query": "test query"}
|
|
self.gen.set_follow_up_context(ctx)
|
|
assert self.gen.follow_up_context is ctx
|
|
|
|
def test_generate_questions_returns_query(self):
|
|
result = self.gen.generate_questions(
|
|
current_knowledge="knowledge",
|
|
query="my query",
|
|
questions_per_iteration=3,
|
|
questions_by_iteration={},
|
|
)
|
|
assert result == ["my query"]
|
|
|
|
|
|
class TestBaseFindingsRepository:
|
|
def test_init_sets_model_and_findings(self):
|
|
model = Mock()
|
|
repo = ConcreteFindingsRepository(model=model)
|
|
assert repo.model is model
|
|
assert repo.findings == {}
|