7a0da7932b
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
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Has been cancelled
Docker Tests (Consolidated) / Accessibility Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Unit Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Example Tests (push) Has been cancelled
Docker Tests (Consolidated) / Production Image Smoke Test (push) Has been cancelled
Docker Tests (Consolidated) / Infrastructure Tests (push) Has been cancelled
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Has been cancelled
Backwards Compatibility / Verify Encryption Constants (push) Has been cancelled
Backwards Compatibility / PyPI Version Compatibility (push) Has been cancelled
Backwards Compatibility / Database Migration Tests (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Docker Tests (Consolidated) / detect-changes (push) Has been cancelled
Docker Tests (Consolidated) / Build Test Image (push) Has been cancelled
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Has been cancelled
74 lines
2.4 KiB
Python
74 lines
2.4 KiB
Python
"""High-value tests for utilities/search_utilities.py pure logic."""
|
|
|
|
import unittest
|
|
|
|
from local_deep_research.utilities.search_utilities import (
|
|
LANGUAGE_CODE_MAP,
|
|
format_findings,
|
|
)
|
|
|
|
|
|
class TestLanguageCodeMap(unittest.TestCase):
|
|
def test_english_maps_to_en(self):
|
|
assert LANGUAGE_CODE_MAP["english"] == "en"
|
|
|
|
def test_contains_major_languages(self):
|
|
for lang in ("french", "german", "spanish", "japanese", "chinese"):
|
|
assert lang in LANGUAGE_CODE_MAP
|
|
|
|
|
|
class TestFormatFindings(unittest.TestCase):
|
|
def test_followup_phase_parsing(self):
|
|
findings = [
|
|
{
|
|
"phase": "Follow-up Iteration 1.2",
|
|
"content": "Content.",
|
|
"search_results": [],
|
|
}
|
|
]
|
|
questions = {1: ["First Q", "Second Q"]}
|
|
result = format_findings(findings, "Sum.", questions)
|
|
# "Second Q" must appear in the DETAILED FINDINGS section (phase-parsed),
|
|
# not just in the questions-by-iteration listing
|
|
detailed_section = result.split("DETAILED FINDINGS")[-1]
|
|
assert "Second Q" in detailed_section
|
|
|
|
def test_subquery_phase_parsing(self):
|
|
findings = [
|
|
{
|
|
"phase": "Sub-query 1",
|
|
"content": "Content.",
|
|
"search_results": [],
|
|
}
|
|
]
|
|
questions = {0: ["Sub Q1", "Sub Q2"]}
|
|
result = format_findings(findings, "Sum.", questions)
|
|
# "Sub Q1" must appear in the DETAILED FINDINGS section (phase-parsed),
|
|
# not just in the questions-by-iteration listing
|
|
detailed_section = result.split("DETAILED FINDINGS")[-1]
|
|
assert "Sub Q1" in detailed_section
|
|
|
|
def test_question_in_finding_dict(self):
|
|
findings = [
|
|
{
|
|
"phase": "Custom Phase",
|
|
"content": "Content.",
|
|
"question": "My question?",
|
|
"search_results": [],
|
|
}
|
|
]
|
|
result = format_findings(findings, "Sum.", {})
|
|
assert "My question?" in result
|
|
|
|
def test_detailed_findings_section(self):
|
|
findings = [
|
|
{"phase": "Phase 1", "content": "Details.", "search_results": []}
|
|
]
|
|
result = format_findings(findings, "Sum.", {})
|
|
assert "DETAILED FINDINGS" in result
|
|
assert "Phase 1" in result
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|