项目文件夹

文件
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

120 行
4.3 KiB
Python

"""Edge-case tests for search_utilities — format_findings phase parsing and graceful handling."""
class TestFormatFindingsMalformedPhaseNonNumeric:
"""Verify ValueError from int() on non-numeric phase is caught gracefully."""
def test_format_findings_malformed_phase_non_numeric(self):
"""'Follow-up Iteration abc.1' → int('abc') raises ValueError, caught gracefully."""
from local_deep_research.utilities.search_utilities import (
format_findings,
)
findings = [
{
"phase": "Follow-up Iteration abc.1",
"content": "Some content here.",
"search_results": [],
"question": "Fallback question text",
}
]
questions = {1: ["Question one"]}
result = format_findings(findings, "Synthesized content", questions)
# Should not raise — ValueError is caught
assert "Some content here." in result
# Since parsing failed, the finding's own question should be displayed as fallback
assert "Fallback question text" in result
class TestFormatFindingsOutOfBoundsIteration:
"""Verify out-of-bounds iteration index is handled gracefully."""
def test_format_findings_out_of_bounds_iteration(self):
"""Phase 'Follow-up Iteration 999.1' with missing iteration key → warning, no crash."""
from local_deep_research.utilities.search_utilities import (
format_findings,
)
findings = [
{
"phase": "Follow-up Iteration 999.1",
"content": "Out of bounds content.",
"search_results": [],
"question": "OOB fallback question",
}
]
# Only iteration 1 exists, not 999
questions = {1: ["Only question in iteration 1"]}
result = format_findings(findings, "Summary", questions)
assert "Out of bounds content." in result
# Iteration 999 doesn't exist, so fallback to finding's own question
assert "OOB fallback question" in result
class TestFormatFindingsNoneSearchResults:
"""Verify None search_results (instead of list) is handled gracefully."""
def test_format_findings_none_search_results(self):
"""finding['search_results'] = None should not crash extract_links_from_search_results."""
from local_deep_research.utilities.search_utilities import (
format_findings,
)
findings = [
{
"phase": "Initial Search",
"content": "Content with None results.",
"search_results": None,
}
]
# Should not raise TypeError
result = format_findings(findings, "Summary", {})
assert "Content with None results." in result
class TestFormatFindingsEmptyFindingsList:
"""Verify empty findings_list produces valid output structure."""
def test_format_findings_empty_findings_list(self):
"""Empty findings_list should produce output with synthesized content but no DETAILED FINDINGS."""
from local_deep_research.utilities.search_utilities import (
format_findings,
)
result = format_findings([], "My synthesized summary", {})
assert "My synthesized summary" in result
# With empty findings, the DETAILED FINDINGS header should NOT appear
assert "DETAILED FINDINGS" not in result
class TestFormatFindingsSubqueryPhaseParsing:
"""Verify 'Sub-query X' phase correctly parsed for IterDRAG-style results."""
def test_format_findings_subquery_phase_parsing(self):
"""'Sub-query 2' should look up questions_by_iteration[0][1] (index 1)."""
from local_deep_research.utilities.search_utilities import (
format_findings,
)
findings = [
{
"phase": "Sub-query 2",
"content": "Sub-query content.",
"search_results": [],
}
]
# IterDRAG stores sub-queries in iteration 0
questions = {0: ["First sub-query?", "Second sub-query?"]}
result = format_findings(findings, "Summary", questions)
assert "Sub-query content." in result
# "Sub-query 2" → index 1 → "Second sub-query?"
assert "Second sub-query?" in result