Skip to content

Commit

Permalink
removing agent prompt and adding unit tests for task queue
Browse files Browse the repository at this point in the history
  • Loading branch information
TransformerOptimus committed Jun 5, 2023
1 parent c6a5fc0 commit bea0062
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 149 deletions.
120 changes: 0 additions & 120 deletions gui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions superagi/agent/agent_prompt.py

This file was deleted.

6 changes: 3 additions & 3 deletions superagi/agent/agent_prompt_builder.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
import re

from pydantic.types import List
from superagi.agent.agent_prompt import AgentPrompt

from superagi.helper.token_counter import TokenCounter
from superagi.tools.base_tool import BaseTool
from fastapi_sqlalchemy import db
import re

FINISH_NAME = "finish"

Expand Down
11 changes: 0 additions & 11 deletions superagi/agent/task_listener.py

This file was deleted.

Empty file added tests/agent/__init__.py
Empty file.
51 changes: 51 additions & 0 deletions tests/agent/test_task_queue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import unittest
from unittest.mock import patch

from superagi.agent.task_queue import TaskQueue


class TaskQueueTests(unittest.TestCase):
def setUp(self):
self.queue_name = "test_queue"
self.queue = TaskQueue(self.queue_name)

@patch.object(TaskQueue, 'add_task')
def test_add_task(self, mock_add_task):
task = "Do something"
self.queue.add_task(task)
mock_add_task.assert_called_with(task)

@patch.object(TaskQueue, 'complete_task')
def test_complete_task(self, mock_complete_task):
task = "Do something"
response = "Task completed"
self.queue.complete_task(response)
mock_complete_task.assert_called_with(response)

@patch.object(TaskQueue, 'get_first_task')
def test_get_first_task(self, mock_get_first_task):
self.queue.get_first_task()
mock_get_first_task.assert_called()

@patch.object(TaskQueue, 'get_tasks')
def test_get_tasks(self, mock_get_tasks):
self.queue.get_tasks()
mock_get_tasks.assert_called()

@patch.object(TaskQueue, 'get_completed_tasks')
def test_get_completed_tasks(self, mock_get_completed_tasks):
self.queue.get_completed_tasks()
mock_get_completed_tasks.assert_called()

@patch.object(TaskQueue, 'clear_tasks')
def test_clear_tasks(self, mock_clear_tasks):
self.queue.clear_tasks()
mock_clear_tasks.assert_called()

@patch.object(TaskQueue, 'get_last_task_details')
def test_get_last_task_details(self, mock_get_last_task_details):
self.queue.get_last_task_details()
mock_get_last_task_details.assert_called()

if __name__ == '__main__':
unittest.main()

0 comments on commit bea0062

Please sign in to comment.