- Move cashflow_model/ -> domain/ - Move engine/ -> application/ - Move cli/, sync/, ai/ -> infrastructure/ - Update all imports across codebase and tests - Add version=1 to FinancialModel.to_dict() with migration hook in from_dict - Update pyproject.toml: cf entry point and packages.find Tests: 63/63 pass.
25 lines
951 B
Python
25 lines
951 B
Python
from infrastructure.ai.assistant import AssistantService
|
|
from infrastructure.ai.prompts import ADVICE_PROMPT, ANALYZE_PROMPT
|
|
|
|
|
|
class TestAssistantService:
|
|
def test_analyze_returns_prompt(self, sample_model):
|
|
assistant = AssistantService(sample_model)
|
|
result = assistant.analyze(months=6)
|
|
assert "prompt" in result
|
|
assert "summary" in result
|
|
assert "forecast" in result
|
|
assert result["ai_response"] is None
|
|
|
|
def test_advice_returns_prompt(self, sample_model):
|
|
assistant = AssistantService(sample_model)
|
|
result = assistant.advice("Как мне сэкономить?", months=6)
|
|
assert "prompt" in result
|
|
assert "ai_response" in result
|
|
|
|
def test_prompt_templates(self):
|
|
assert "{model_json}" in ANALYZE_PROMPT
|
|
assert "{forecast_json}" in ANALYZE_PROMPT
|
|
assert "{model_json}" in ADVICE_PROMPT
|
|
assert "{question}" in ADVICE_PROMPT
|