From 83583f866c84d6cf772500a626204f6361a06d3d Mon Sep 17 00:00:00 2001 From: Ryan Frederich Date: Sat, 9 Nov 2024 09:41:20 -0800 Subject: [PATCH 1/2] Changed gpt prompt --- tests/test_gpt.py | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/test_gpt.py b/tests/test_gpt.py index c14e904..2e8ec46 100644 --- a/tests/test_gpt.py +++ b/tests/test_gpt.py @@ -11,19 +11,37 @@ def test_simple_gpt(): """ Testing the simple_gpt function Calls the simple gpt and asks it to output - "gpt works". If anything else is outputted, we can - assume an error has occured + the days of the week. If the output does not contain + any day of the week, we assume the gpt is non-fucntional """ - surf_summary = ( - "Please respond with the exact phrase 'gpt works'. " - "Do not include any additional text or context." - ) + surf_summary = "" + gpt_prompt = ( + """Please output the days of the week in English. What day + is your favorite?""" + ) + + gpt_response = gpt.simple_gpt(surf_summary, gpt_prompt).lower() + expected_response = set([ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday" + "saturday", + "sunday", + "一", + "二", + "三", + "四", + "五" + ]) + + # Can case the "gpt_response" string into a list, and + # check for set intersection with the expected response set + gpt_response_set = set(gpt_response.split()) - gpt_prompt = "This is for testing purposes" - gpt_response = gpt.simple_gpt(surf_summary, gpt_prompt) - expected_response = "gpt works" assert ( - gpt_response == expected_response + gpt_response_set.intersection(expected_response) ), f"Expected '{expected_response}', but got: {gpt_response}" From 527dda2814f920757a9a445b9c8273a3dae5ed33 Mon Sep 17 00:00:00 2001 From: Ryan Frederich Date: Sat, 9 Nov 2024 09:44:30 -0800 Subject: [PATCH 2/2] linting errors --- tests/test_gpt.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/test_gpt.py b/tests/test_gpt.py index 2e8ec46..3ba8985 100644 --- a/tests/test_gpt.py +++ b/tests/test_gpt.py @@ -16,10 +16,8 @@ def test_simple_gpt(): """ surf_summary = "" - gpt_prompt = ( - """Please output the days of the week in English. What day + gpt_prompt = """Please output the days of the week in English. What day is your favorite?""" - ) gpt_response = gpt.simple_gpt(surf_summary, gpt_prompt).lower() expected_response = set([ @@ -27,21 +25,19 @@ def test_simple_gpt(): "tuesday", "wednesday", "thursday", - "friday" - "saturday", + "friday" "saturday", "sunday", "一", "二", "三", "四", - "五" + "五", ]) - # Can case the "gpt_response" string into a list, and - # check for set intersection with the expected response set + # Can case the "gpt_response" string into a list, and + # check for set intersection with the expected response set gpt_response_set = set(gpt_response.split()) - - assert ( - gpt_response_set.intersection(expected_response) + assert gpt_response_set.intersection( + expected_response ), f"Expected '{expected_response}', but got: {gpt_response}"