-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error handling fix.
- Loading branch information
Showing
2 changed files
with
9 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
import unittest | ||
from datetime import datetime | ||
|
||
from superagi.helper.feed_parser import parse_feed | ||
from superagi.models.agent_execution_feed import AgentExecutionFeed | ||
|
||
|
||
class TestParseFeed(unittest.TestCase): | ||
|
||
def test_parse_feed_system(self): | ||
current_time = datetime.now() | ||
sample_feed = AgentExecutionFeed( | ||
id=2, agent_execution_id=100, agent_id=200, role="user", | ||
feed='System message', updated_at=current_time | ||
) | ||
|
||
# Create a sample AgentExecutionFeed object with a system role | ||
sample_feed = AgentExecutionFeed(id=2, agent_execution_id=100, agent_id=200, role="assistant", | ||
feed='System message', | ||
updated_at=current_time) | ||
|
||
# Call the parse_feed function with the sample_feed object | ||
result = parse_feed(sample_feed) | ||
|
||
# In this test case, we only ensure that the parse_feed function doesn't modify the given feed | ||
self.assertEqual(result, sample_feed, "Incorrect output from parse_feed function for system role") | ||
self.assertEqual(result['feed'], sample_feed.feed, "Incorrect output from parse_feed function for system role") | ||
self.assertEqual(result['role'], sample_feed.role, "Incorrect output from parse_feed function for system role") |