llm-chat/tests/test_chat.py

15 lines
446 B
Python
Raw Normal View History

from unittest.mock import patch
from llm_chat.chat import Chat
def test_send_message() -> None:
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!"