25 lines
921 B
Python
25 lines
921 B
Python
from ai.assistant import AssistantService
|
|
from 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
|