From 18f1efc4b30e36d25d05005d04befa9d3cec65ea Mon Sep 17 00:00:00 2001 From: Andres Caicedo Date: Thu, 20 Apr 2023 20:59:00 +0200 Subject: [PATCH] Update test_chat.py --- tests/unit/test_chat.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unit/test_chat.py b/tests/unit/test_chat.py index 774f4103762c..a3851c6e80f2 100644 --- a/tests/unit/test_chat.py +++ b/tests/unit/test_chat.py @@ -7,19 +7,23 @@ class TestChat(unittest.TestCase): + """Test the chat functions.""" # Tests that the function returns a dictionary with the correct keys and values when valid strings are provided for role and content. def test_happy_path_role_content(self): + """Test that the function returns a dictionary with the correct keys and values when valid strings are provided for role and content.""" result = create_chat_message("system", "Hello, world!") self.assertEqual(result, {"role": "system", "content": "Hello, world!"}) # Tests that the function returns a dictionary with the correct keys and values when empty strings are provided for role and content. def test_empty_role_content(self): + """Test that the function returns a dictionary with the correct keys and values when empty strings are provided for role and content.""" result = create_chat_message("", "") self.assertEqual(result, {"role": "", "content": ""}) # Tests the behavior of the generate_context function when all input parameters are empty. @patch("time.strftime") def test_generate_context_empty_inputs(self, mock_strftime): + """Test the behavior of the generate_context function when all input parameters are empty.""" # Mock the time.strftime function to return a fixed value mock_strftime.return_value = "Sat Apr 15 00:00:00 2023" # Arrange @@ -52,6 +56,7 @@ def test_generate_context_empty_inputs(self, mock_strftime): # Tests that the function successfully generates a current_context given valid inputs. def test_generate_context_valid_inputs(self): + """Test that the function successfully generates a current_context given valid inputs.""" # Given prompt = "What is your favorite color?" relevant_memory = "You once painted your room blue."