llm-chat/tests/test_chat.py

14 lines
432 B
Python
Raw Normal View History

from unittest.mock import patch
import llm_chat
from llm_chat.chat import Chat
def test_send_message():
with patch("llm_chat.chat.Chat._make_request") as mock_make_request:
mock_make_request.return_value = {"choices": [{"message": {"content": "Hello!"}}]}
conversation = Chat()
response = conversation.send_message("Hello")
assert isinstance(response, str)
assert response == "Hello!"