Download tests/unit/test_commands.py from MathysL/AutoGPT4: direct link, hf CLI and curl.
- Browser
- Download file 827 Bytes
-
https://huggingface.co/spaces/MathysL/AutoGPT4/resolve/main/tests/unit/test_commands.py
- Command line
-
hf download hf://spaces/MathysL/AutoGPT4/tests/unit/test_commands.py
-
curl -L -o test_commands.py https://huggingface.co/spaces/MathysL/AutoGPT4/resolve/main/tests/unit/test_commands.py
827 Bytes
| """Unit tests for the commands module""" | |
| from unittest.mock import MagicMock, patch | |
| import pytest | |
| import autogpt.agent.agent_manager as agent_manager | |
| from autogpt.app import execute_command, list_agents, start_agent | |
| def test_make_agent() -> None: | |
| """Test the make_agent command""" | |
| with patch("openai.ChatCompletion.create") as mock: | |
| obj = MagicMock() | |
| obj.response.choices[0].messages[0].content = "Test message" | |
| mock.return_value = obj | |
| start_agent("Test Agent", "chat", "Hello, how are you?", "gpt2") | |
| agents = list_agents() | |
| assert "List of agents:\n0: chat" == agents | |
| start_agent("Test Agent 2", "write", "Hello, how are you?", "gpt2") | |
| agents = list_agents() | |
| assert "List of agents:\n0: chat\n1: write" == agents | |