Files
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

197 lines
6.5 KiB
Python

"""
Behavioral tests for followup_research models.
Tests the FollowUpRequest dataclass.
"""
class TestFollowUpRequestInit:
"""Tests for FollowUpRequest initialization."""
def test_requires_parent_research_id(self):
"""Requires parent_research_id."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="What about X?"
)
assert request.parent_research_id == "abc123"
def test_requires_question(self):
"""Requires question."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="What about X?"
)
assert request.question == "What about X?"
def test_default_strategy_is_source_based(self):
"""Default strategy is source-based."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
assert request.strategy == "source-based"
def test_accepts_custom_strategy(self):
"""Accepts custom strategy."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123",
question="Question",
strategy="deep-dive",
)
assert request.strategy == "deep-dive"
def test_default_max_iterations_is_1(self):
"""Default max_iterations is 1."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
assert request.max_iterations == 1
def test_accepts_custom_max_iterations(self):
"""Accepts custom max_iterations."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123",
question="Question",
max_iterations=5,
)
assert request.max_iterations == 5
def test_default_questions_per_iteration_is_3(self):
"""Default questions_per_iteration is 3."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
assert request.questions_per_iteration == 3
def test_accepts_custom_questions_per_iteration(self):
"""Accepts custom questions_per_iteration."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123",
question="Question",
questions_per_iteration=5,
)
assert request.questions_per_iteration == 5
class TestFollowUpRequestToDict:
"""Tests for FollowUpRequest.to_dict method."""
def test_returns_dict(self):
"""to_dict returns a dictionary."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
result = request.to_dict()
assert isinstance(result, dict)
def test_includes_parent_research_id(self):
"""Includes parent_research_id in dict."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
result = request.to_dict()
assert result["parent_research_id"] == "abc123"
def test_includes_question(self):
"""Includes question in dict."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="What about X?"
)
result = request.to_dict()
assert result["question"] == "What about X?"
def test_includes_strategy(self):
"""Includes strategy in dict."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123",
question="Question",
strategy="deep-dive",
)
result = request.to_dict()
assert result["strategy"] == "deep-dive"
def test_includes_max_iterations(self):
"""Includes max_iterations in dict."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question", max_iterations=5
)
result = request.to_dict()
assert result["max_iterations"] == 5
def test_includes_questions_per_iteration(self):
"""Includes questions_per_iteration in dict."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123",
question="Question",
questions_per_iteration=10,
)
result = request.to_dict()
assert result["questions_per_iteration"] == 10
def test_dict_has_all_fields(self):
"""Dict has all expected fields."""
from local_deep_research.followup_research.models import FollowUpRequest
request = FollowUpRequest(
parent_research_id="abc123", question="Question"
)
result = request.to_dict()
expected_keys = {
"parent_research_id",
"question",
"strategy",
"max_iterations",
"questions_per_iteration",
}
assert set(result.keys()) == expected_keys
class TestFollowUpModelsDataclass:
"""Tests for dataclass behavior."""
def test_request_is_dataclass(self):
"""FollowUpRequest is a dataclass."""
from dataclasses import is_dataclass
from local_deep_research.followup_research.models import FollowUpRequest
assert is_dataclass(FollowUpRequest)
def test_request_equality(self):
"""FollowUpRequest supports equality comparison."""
from local_deep_research.followup_research.models import FollowUpRequest
req1 = FollowUpRequest(
parent_research_id="abc", question="Q", strategy="s"
)
req2 = FollowUpRequest(
parent_research_id="abc", question="Q", strategy="s"
)
assert req1 == req2