diff --git a/tests/agents/test_idea_to_image.py b/tests/agents/test_idea_to_image.py deleted file mode 100644 index 7aecd5c5..00000000 --- a/tests/agents/test_idea_to_image.py +++ /dev/null @@ -1,65 +0,0 @@ -import pytest -import os -import shutil -from swarms.agents.idea_to_image_agent import Idea2Image - -openai_key = os.getenv("OPENAI_API_KEY") -dalle_cookie = os.getenv("BING_COOKIE") - -# Constants for testing -TEST_PROMPT = "Happy fish." -TEST_OUTPUT_FOLDER = "test_images/" -OPENAI_API_KEY = openai_key -DALLE_COOKIE = dalle_cookie - - -@pytest.fixture(scope="module") -def idea2image_instance(): - # Create an instance of the Idea2Image class - idea2image = Idea2Image( - image=TEST_PROMPT, - openai_api_key=OPENAI_API_KEY, - cookie=DALLE_COOKIE, - output_folder=TEST_OUTPUT_FOLDER, - ) - yield idea2image - # Clean up the test output folder after testing - if os.path.exists(TEST_OUTPUT_FOLDER): - shutil.rmtree(TEST_OUTPUT_FOLDER) - - -def test_idea2image_instance(idea2image_instance): - # Check if the instance is created successfully - assert isinstance(idea2image_instance, Idea2Image) - - -def test_llm_prompt(idea2image_instance): - # Test the llm_prompt method - prompt = idea2image_instance.llm_prompt() - assert isinstance(prompt, str) - - -def test_generate_image(idea2image_instance): - # Test the generate_image method - idea2image_instance.generate_image() - # Check if the output folder is created - assert os.path.exists(TEST_OUTPUT_FOLDER) - # Check if files are downloaded (assuming DALLE-3 responds with URLs) - files = os.listdir(TEST_OUTPUT_FOLDER) - assert len(files) > 0 - - -def test_invalid_openai_api_key(): - # Test with an invalid OpenAI API key - with pytest.raises(Exception) as exc_info: - Idea2Image( - image=TEST_PROMPT, - openai_api_key="invalid_api_key", - cookie=DALLE_COOKIE, - output_folder=TEST_OUTPUT_FOLDER, - ) - assert "Failed to initialize OpenAIChat" in str(exc_info.value) - - -if __name__ == "__main__": - pytest.main() diff --git a/tests/agents/test_omni_modal.py b/tests/agents/test_omni_modal.py deleted file mode 100644 index 41aa050b..00000000 --- a/tests/agents/test_omni_modal.py +++ /dev/null @@ -1,40 +0,0 @@ -import pytest -from langchain.base_language import BaseLanguageModel - -from swarms.agents.omni_modal_agent import ( - OmniModalAgent, # Replace `your_module_name` with the appropriate module name -) - - -# Mock objects or set up fixtures for dependent classes or external methods -@pytest.fixture -def mock_llm(): - # For this mock, we are assuming the BaseLanguageModel has a method named "process" - class MockLLM(BaseLanguageModel): - def process(self, input): - return "mock response" - - return MockLLM() - - -@pytest.fixture -def omni_agent(mock_llm): - return OmniModalAgent(mock_llm) - - -def test_omnimodalagent_initialization(omni_agent): - assert omni_agent.llm is not None, "LLM initialization failed" - assert len(omni_agent.tools) > 0, "Tools initialization failed" - - -def test_omnimodalagent_run(omni_agent): - input_string = "Hello, how are you?" - response = omni_agent.run(input_string) - assert response is not None, "Response generation failed" - assert isinstance(response, str), "Response should be a string" - - -def test_task_executor_initialization(omni_agent): - assert ( - omni_agent.task_executor is not None - ), "TaskExecutor initialization failed"