formatting

This commit is contained in:
Alrik Olson
2023-04-13 11:36:48 -07:00
parent 94845aa0e1
commit 8186ccb56a
2 changed files with 6 additions and 3 deletions

View File

@@ -1,9 +1,10 @@
from promptgenerator import PromptGenerator from promptgenerator import PromptGenerator
def get_prompt(): def get_prompt():
""" """
This function generates a prompt string that includes various constraints, commands, resources, and performance evaluations. This function generates a prompt string that includes various constraints, commands, resources, and performance evaluations.
Returns: Returns:
str: The generated prompt string. str: The generated prompt string.
""" """
@@ -58,5 +59,5 @@ def get_prompt():
# Generate the prompt string # Generate the prompt string
prompt_string = prompt_generator.generate_prompt_string() prompt_string = prompt_generator.generate_prompt_string()
return prompt_string return prompt_string

View File

@@ -7,6 +7,7 @@ import os
sys.path.append(os.path.abspath("../scripts")) sys.path.append(os.path.abspath("../scripts"))
from promptgenerator import PromptGenerator from promptgenerator import PromptGenerator
# Create a test class for the PromptGenerator, subclassed from unittest.TestCase # Create a test class for the PromptGenerator, subclassed from unittest.TestCase
class promptgenerator_tests(unittest.TestCase): class promptgenerator_tests(unittest.TestCase):
@@ -81,7 +82,7 @@ class promptgenerator_tests(unittest.TestCase):
self.assertIn(constraint, prompt_string) self.assertIn(constraint, prompt_string)
for command in commands: for command in commands:
self.assertIn(command["name"], prompt_string) self.assertIn(command["name"], prompt_string)
# Check for each key-value pair in the command args dictionary # Check for each key-value pair in the command args dictionary
for key, value in command["args"].items(): for key, value in command["args"].items():
self.assertIn(f'"{key}": "{value}"', prompt_string) self.assertIn(f'"{key}": "{value}"', prompt_string)
@@ -94,6 +95,7 @@ class promptgenerator_tests(unittest.TestCase):
self.assertIn("resources", prompt_string.lower()) self.assertIn("resources", prompt_string.lower())
self.assertIn("performance evaluation", prompt_string.lower()) self.assertIn("performance evaluation", prompt_string.lower())
# Run the tests when this script is executed # Run the tests when this script is executed
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()