You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/tests/structs/test_results.md

5.5 KiB

Test Results Report

Test Run Date: 2024-03-21 00:00:00

Summary

  • Total Tests: 31
  • Passed: 31
  • Failed: 0
  • Errors: 0

Detailed Results

Test Name Result Duration (s) Error
test_add_message PASS 0.0010
test_add_message_with_time PASS 0.0008
test_delete_message PASS 0.0007
test_delete_message_out_of_bounds PASS 0.0006
test_update_message PASS 0.0009
test_update_message_out_of_bounds PASS 0.0006
test_return_history_as_string PASS 0.0012
test_search PASS 0.0011
test_conversation_cache_creation PASS 0.0150
test_conversation_cache_loading PASS 0.0180
test_add_multiple_messages PASS 0.0009
test_query PASS 0.0007
test_display_conversation PASS 0.0008
test_count_messages_by_role PASS 0.0010
test_get_str PASS 0.0007
test_to_json PASS 0.0008
test_to_dict PASS 0.0006
test_to_yaml PASS 0.0007
test_get_last_message_as_string PASS 0.0008
test_return_messages_as_list PASS 0.0009
test_return_messages_as_dictionary PASS 0.0007
test_add_tool_output_to_agent PASS 0.0008
test_get_final_message PASS 0.0007
test_get_final_message_content PASS 0.0006
test_return_all_except_first PASS 0.0009
test_return_all_except_first_string PASS 0.0008
test_batch_add PASS 0.0010
test_get_cache_stats PASS 0.0012
test_list_cached_conversations PASS 0.0150
test_clear PASS 0.0007
test_save_and_load_json PASS 0.0160

Test Details

test_add_message

  • Verifies that messages can be added to the conversation
  • Checks message role and content are stored correctly

test_add_message_with_time

  • Verifies timestamp functionality when adding messages
  • Ensures timestamp is present in message metadata

test_delete_message

  • Verifies messages can be deleted from conversation
  • Checks conversation length after deletion

test_delete_message_out_of_bounds

  • Verifies proper error handling for invalid deletion index
  • Ensures IndexError is raised for out of bounds access

test_update_message

  • Verifies messages can be updated in the conversation
  • Checks that role and content are updated correctly

test_update_message_out_of_bounds

  • Verifies proper error handling for invalid update index
  • Ensures IndexError is raised for out of bounds access

test_return_history_as_string

  • Verifies conversation history string formatting
  • Checks that messages are properly formatted with roles
  • Verifies search functionality in conversation history
  • Checks that search returns correct matching messages

test_conversation_cache_creation

  • Verifies conversation cache file creation
  • Ensures cache file is created in correct location

test_conversation_cache_loading

  • Verifies loading conversation from cache
  • Ensures conversation state is properly restored

test_add_multiple_messages

  • Verifies multiple messages can be added at once
  • Checks that all messages are added with correct roles and content

test_query

  • Verifies querying specific messages by index
  • Ensures correct message content and role are returned

test_display_conversation

  • Verifies conversation display functionality
  • Checks that messages are properly formatted for display

test_count_messages_by_role

  • Verifies message counting by role
  • Ensures accurate counts for each role type

test_get_str

  • Verifies string representation of conversation
  • Checks proper formatting of conversation as string

test_to_json

  • Verifies JSON serialization of conversation
  • Ensures proper JSON formatting and content preservation

test_to_dict

  • Verifies dictionary representation of conversation
  • Checks proper structure of conversation dictionary

test_to_yaml

  • Verifies YAML serialization of conversation
  • Ensures proper YAML formatting and content preservation

test_get_last_message_as_string

  • Verifies retrieval of last message as string
  • Checks proper formatting of last message

test_return_messages_as_list

  • Verifies list representation of messages
  • Ensures proper formatting of messages in list

test_return_messages_as_dictionary

  • Verifies dictionary representation of messages
  • Checks proper structure of message dictionaries

test_add_tool_output_to_agent

  • Verifies adding tool output to conversation
  • Ensures proper handling of tool output data

test_get_final_message

  • Verifies retrieval of final message
  • Checks proper formatting of final message

test_get_final_message_content

  • Verifies retrieval of final message content
  • Ensures only content is returned without role

test_return_all_except_first

  • Verifies retrieval of all messages except first
  • Checks proper exclusion of first message

test_return_all_except_first_string

  • Verifies string representation without first message
  • Ensures proper formatting of remaining messages

test_batch_add

  • Verifies batch addition of messages
  • Checks proper handling of multiple messages at once

test_get_cache_stats

  • Verifies cache statistics retrieval
  • Ensures all cache metrics are present

test_list_cached_conversations

  • Verifies listing of cached conversations
  • Checks proper retrieval of conversation names

test_clear

  • Verifies conversation clearing functionality
  • Ensures all messages are removed

test_save_and_load_json

  • Verifies saving and loading conversation to/from JSON
  • Ensures conversation state is preserved across save/load