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.
26 lines
1.0 KiB
26 lines
1.0 KiB
import pytest
|
|
from unittest.mock import Mock
|
|
from swarms.workers.multi_modal_worker import MultiModalVisualAgent, MultiModalVisualAgentTool
|
|
|
|
@pytest.fixture
|
|
def multimodal_agent():
|
|
# Mock the MultiModalVisualAgent
|
|
mock_agent = Mock(spec=MultiModalVisualAgent)
|
|
mock_agent.run_text.return_value = "Expected output from agent"
|
|
return mock_agent
|
|
|
|
@pytest.fixture
|
|
def multimodal_agent_tool(multimodal_agent):
|
|
# Use the mocked MultiModalVisualAgent in the MultiModalVisualAgentTool
|
|
return MultiModalVisualAgentTool(multimodal_agent)
|
|
|
|
@pytest.mark.parametrize("text_input, expected_output", [
|
|
("Hello, world!", "Expected output from agent"),
|
|
("Another task", "Expected output from agent"),
|
|
])
|
|
def test_run(multimodal_agent_tool, text_input, expected_output):
|
|
assert multimodal_agent_tool._run(text_input) == expected_output
|
|
|
|
# You can also test if the MultiModalVisualAgent's run_text method was called with the right argument
|
|
multimodal_agent_tool.agent.run_text.assert_called_with(text_input)
|