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.
55 lines
1.2 KiB
55 lines
1.2 KiB
import pytest
|
|
from unittest.mock import Mock, patch
|
|
from swarms.models.multion import MultiOn
|
|
|
|
|
|
@pytest.fixture
|
|
def multion_instance():
|
|
return MultiOn()
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_multion():
|
|
return Mock()
|
|
|
|
|
|
def test_multion_import():
|
|
with pytest.raises(ImportError):
|
|
import multion
|
|
|
|
|
|
def test_multion_init():
|
|
multion = MultiOn()
|
|
assert isinstance(multion, MultiOn)
|
|
|
|
|
|
def test_multion_run_with_valid_input(multion_instance, mock_multion):
|
|
task = "Order chicken tendies"
|
|
url = "https://www.google.com/"
|
|
mock_multion.new_session.return_value = (
|
|
"Order chicken tendies. https://www.google.com/"
|
|
)
|
|
|
|
with patch("swarms.models.multion.multion", mock_multion):
|
|
response = multion_instance.run(task, url)
|
|
|
|
assert (
|
|
response == "Order chicken tendies. https://www.google.com/"
|
|
)
|
|
|
|
|
|
def test_multion_run_with_invalid_input(
|
|
multion_instance, mock_multion
|
|
):
|
|
task = ""
|
|
url = "https://www.google.com/"
|
|
mock_multion.new_session.return_value = None
|
|
|
|
with patch("swarms.models.multion.multion", mock_multion):
|
|
response = multion_instance.run(task, url)
|
|
|
|
assert response is None
|
|
|
|
|
|
# Add more test cases to cover different scenarios, edge cases, and error handling as needed.
|