From 551e0a254db6fd16ca5103da6529b177af120352 Mon Sep 17 00:00:00 2001 From: pliny <133052465+elder-plinius@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:06:19 -0800 Subject: [PATCH] Create test_multion.py --- tests/models/test_multion.py | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/models/test_multion.py diff --git a/tests/models/test_multion.py b/tests/models/test_multion.py new file mode 100644 index 00000000..707c0798 --- /dev/null +++ b/tests/models/test_multion.py @@ -0,0 +1,41 @@ +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.