repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
snap-stanford/MLAgentBench | import pytest
import requests
from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_text
class TestScrapeText:
def test_http_error(self, mocker, agent: Agent):
"""Test that scrape_text returns an error message when the response status code is an http error (>=400)."""
... | "Error: HTTP 404 error" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_text.py | test_http_error | TestScrapeText | 102 | null |
snap-stanford/MLAgentBench | import os
import yaml
from autogpt.config.config import Config
from autogpt.plugins import inspect_zip_for_modules, scan_plugins
from autogpt.plugins.plugin_config import PluginConfig
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
PLUGIN_TEST_INIT_PY = "Aut... | plugin_class_names | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_scan_plugins_generic | 40 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest import raises
from autogpt.url_utils.validators import validate_url
def dummy_method(url):
return url
class TestValidateUrl:
def test_edge_case_missing_scheme_or_network_location(self):
"""Test that the function raises a ValueError if the URL is missing scheme or network lo... | ValueError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_url_validation.py | test_edge_case_missing_scheme_or_network_location | TestValidateUrl | 114 | null |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | prompt_tokens | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_update_cost_completion_model | TestApiManager | 120 | null |
snap-stanford/MLAgentBench | import pytest
from autogpt.llm.base import Message
from autogpt.llm.utils import count_message_tokens, count_string_tokens
def test_count_message_tokens_empty_input():
"""Empty input should return 3 tokens"""
assert count_message_tokens([]) == | 3 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_token_counter.py | test_count_message_tokens_empty_input | 17 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | None | assert | none_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_default_methods | 59 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | 10 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_create_chat_completion_valid_inputs | TestApiManager | 90 | null |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | mem1 | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get_relevant | 95 | null | |
snap-stanford/MLAgentBench | import importlib.util
import inspect
import os
from types import ModuleType
from typing import List
CHALLENGES_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../challenges"
)
def get_python_files(directory: str, exclude_file: str) -> List[str]:
"""Recursively get all python files in a direc... | test_file) | assert_* | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/test_challenge_should_be_formatted_properly.py | test_method_name_and_count | 59 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | (prompt_tokens * 0.0013 + completion_tokens * 0.0025) / 1000 | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_update_cost_completion_model | TestApiManager | 122 | null |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | mem2 | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get_relevant | 96 | null | |
snap-stanford/MLAgentBench | import functools
import hashlib
from pathlib import Path
from unittest.mock import patch
import pytest
from PIL import Image
from autogpt.agent.agent import Agent
from autogpt.commands.image_gen import generate_image, generate_image_with_sd_webui
from tests.utils import requires_api_key
def image_size(request):
... | ValueError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | test_huggingface_fail_missing_api_token | 252 | null | |
snap-stanford/MLAgentBench | import json
import tempfile
from unittest import TestCase
from xml.etree import ElementTree
import docx
import yaml
from bs4 import BeautifulSoup
from autogpt.commands.file_operations_utils import is_file_binary_fn, read_textual_file
from autogpt.logs import logger
plain_text_str = "Hello, world!"
def mock_text_fil... | is_file_binary_fn(created_filepath)) | self.assertEqual | func_call | MLAgentBench/agents/Auto-GPT/tests/unit/test_text_file_parsers.py | test_parsers | TestConfig | 150 | null |
snap-stanford/MLAgentBench | from unittest.mock import patch
import pytest
from autogpt.config.ai_config import AIConfig
from autogpt.setup import generate_aiconfig_automatic, prompt_user
from tests.utils import requires_api_key
@pytest.mark.vcr
@requires_api_key("OPENAI_API_KEY")
def test_generate_aiconfig_automatic_default(patched_api_request... | len(ai_config.ai_goals) | assert | func_call | MLAgentBench/agents/Auto-GPT/tests/integration/test_setup.py | test_generate_aiconfig_automatic_default | 20 | null | |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_set_fast_llm_model(config: Config):
"""
Test if the set_fast_llm... | "gpt-3.5-turbo-test" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_set_fast_llm_model | 62 | null | |
snap-stanford/MLAgentBench | import hashlib
import os
import re
from io import TextIOWrapper
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import autogpt.commands.file_operations as file_ops
from autogpt.agent.agent import Agent
from autogpt.memory.vector.memory_item import MemoryItem
from autogpt.memory.vector.uti... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_log_operation | 174 | null | |
snap-stanford/MLAgentBench | from datetime import datetime
from pytest_mock import MockerFixture
from autogpt.agent.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
from autogpt.llm.chat import create_chat_completion
from autogpt.log_cycle.log_cycle import LogCycleHandler
def test_get_self_feedback... | feedback | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_get_self_feedback.py | test_get_self_feedback | 62 | null | |
snap-stanford/MLAgentBench | from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_links
class TestScrapeLinks:
def test_scrape_links_with_few_hyperlinks(self, mocker, agent: Agent):
"""Test that scrape_links() correctly extracts and formats hyperlinks from a sample HTML containing a few hyperlinks.""... | "GitHub (https://github.com)" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_links.py | test_scrape_links_with_few_hyperlinks | TestScrapeLinks | 118 | null |
snap-stanford/MLAgentBench | from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_links
class TestScrapeLinks:
def test_scrape_links_with_few_hyperlinks(self, mocker, agent: Agent):
"""Test that scrape_links() correctly extracts and formats hyperlinks from a sample HTML containing a few hyperlinks.""... | "Google (https://www.google.com)" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_links.py | test_scrape_links_with_few_hyperlinks | TestScrapeLinks | 117 | null |
snap-stanford/MLAgentBench | import pytest
from git.exc import GitCommandError
from git.repo.base import Repo
from autogpt.agent.agent import Agent
from autogpt.commands.git_operations import clone_repository
def mock_clone_from(mocker):
return mocker.patch.object(Repo, "clone_from")
def test_clone_auto_gpt_repository(workspace, mock_clone_... | expected_output | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_git_commands.py | test_clone_auto_gpt_repository | 26 | null | |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_initializes_with_default_values():
"""Tests that the spinner initializes with default values."""
with Spinner() as spinner:
assert spinner.message == | "Loading..." | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_initializes_with_default_values | 34 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
OUTPUT_LO... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/memory/test_memory_challenge_a.py | test_memory_challenge_a | 42 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommandRegistry:
def example_command_method(arg1: int, arg2: str) -> str:
return f"{arg1} - {arg2}"
def test... | cmd | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_register_command | TestCommandRegistry | 88 | null |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | total_budget | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_set_total_budget | TestApiManager | 109 | null |
snap-stanford/MLAgentBench | import pytest
from autogpt.llm.base import Message
from autogpt.llm.utils import count_message_tokens, count_string_tokens
def test_count_message_tokens_invalid_model():
"""Invalid model should raise a NotImplementedError"""
messages = [
Message("user", "Hello"),
Message("assistant", "Hi there... | NotImplementedError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_token_counter.py | test_count_message_tokens_invalid_model | 26 | null | |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_stops_spinning():
"""Tests that the spinner starts spinning and stops spinning without errors."""
with Spinner() as spinner:
time.sleep(1)
spinner.update_mess... | False | assert | bool_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_stops_spinning | 52 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | 1 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_default_methods | 66 | null | |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_initializes_with_custom_values():
"""Tests that the spinner initializes with custom message and delay values."""
with Spinner(message=PLEASE_WAIT, delay=0.2) as spinner:
... | 0.2 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_initializes_with_custom_values | 42 | null | |
snap-stanford/MLAgentBench | from autogpt.config.ai_config import AIConfig
def test_ai_config_file_not_exists(workspace):
"""Test if file does not exist."""
config_file = workspace.get_path("ai_settings.yaml")
ai_config = AIConfig.load(str(config_file))
assert ai_config.ai_name == ""
assert ai_config.ai_role == ""
asser... | [] | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_ai_config_file_not_exists | 56 | null | |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | 1 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get_stats | 105 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommandRegistry:
def example_command_method(arg1: int, arg2: str) -> str:
return f"{arg1} - {arg2}"
def test... | "Function-based test command" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_import_mock_commands_module | TestCommandRegistry | 173 | null |
snap-stanford/MLAgentBench | import hashlib
import os
import re
from io import TextIOWrapper
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import autogpt.commands.file_operations as file_ops
from autogpt.agent.agent import Agent
from autogpt.memory.vector.memory_item import MemoryItem
from autogpt.memory.vector.uti... | files | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_list_files | 362 | null | |
snap-stanford/MLAgentBench | from typing import List
import pytest
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
CYCLE_COUNT_PER_LEVEL = [1, 1]
EXPECT... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/basic_abilities/test_write_file.py | test_write_file | 40 | null | |
snap-stanford/MLAgentBench | import pytest
import requests
from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_text
class TestScrapeText:
def test_scrape_text_with_html_tags(self, mocker, agent: Agent):
"""Test that scrape_text() properly handles HTML tags."""
# Create a mock response objec... | "This is bold text." | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_text.py | test_scrape_text_with_html_tags | TestScrapeText | 117 | null |
snap-stanford/MLAgentBench | import pytest
from autogpt.llm.base import Message
from autogpt.llm.utils import count_message_tokens, count_string_tokens
def test_count_string_tokens():
"""Test that the string tokens are counted correctly."""
string = "Hello, world!"
assert count_string_tokens(string, model_name="gpt-3.5-turbo-0301")... | 4 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_token_counter.py | test_count_string_tokens | 42 | null | |
snap-stanford/MLAgentBench | from autogpt.config.ai_config import AIConfig
def test_goals_are_always_lists_of_strings(tmp_path):
"""Test if the goals attribute is always a list of strings."""
yaml_content = """
ai_goals:
- Goal 1: Make a sandwich
- Goal 2, Eat the sandwich
- Goal 3 - Go to sleep
- "Goal 4: Wake up"
ai_name: McFamished
ai... | 4 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_goals_are_always_lists_of_strings | 27 | null | |
snap-stanford/MLAgentBench | import math
import time
from unittest.mock import MagicMock
import pytest
from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
from autogpt.llm.base import ChatSequence, Message
from autogpt.llm.providers.openai import OPEN_AI_CHAT_MODELS
from autogpt.llm.utils ... | message_count | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_message_history.py | test_message_history_batch_summary | 139 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | 2 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_default_methods | 73 | null | |
snap-stanford/MLAgentBench | import os
import yaml
from autogpt.config.config import Config
from autogpt.plugins import inspect_zip_for_modules, scan_plugins
from autogpt.plugins.plugin_config import PluginConfig
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
PLUGIN_TEST_INIT_PY = "Aut... | {} | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_load_config | 111 | null | |
snap-stanford/MLAgentBench | import os
from unittest.mock import patch
import pytest
import requests
from autogpt.json_utils.utilities import extract_json_from_response, validate_json
from autogpt.utils import (
get_bulletin_from_web,
get_current_git_branch,
get_latest_bulletin,
readable_file_size,
validate_yaml_file,
)
from ... | "" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_get_bulletin_from_web_failure | 105 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest import raises
from autogpt.url_utils.validators import validate_url
def dummy_method(url):
return url
class TestValidateUrl:
def test_happy_path_valid_url(self):
"""Test that the function successfully validates a valid URL with http:// or https:// prefix"""
@valida... | "http://www.google.com" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_url_validation.py | test_happy_path_valid_url | TestValidateUrl | 91 | null |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_missing_azure_config(config: Config, workspace: Workspace):
config_f... | "" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_missing_azure_config | 143 | null | |
snap-stanford/MLAgentBench | import hashlib
import os
import re
from io import TextIOWrapper
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import autogpt.commands.file_operations as file_ops
from autogpt.agent.agent import Agent
from autogpt.memory.vector.memory_item import MemoryItem
from autogpt.memory.vector.uti... | expected_content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_replace_in_file_all_occurrences | 259 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | "Dummy" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_name | 32 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.agent import Agent
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import run_interaction_loop
CYCLE_COUNT = 2
@challenge()
def test_browse_website(
browser_agent: Agent,
patched_api_requestor: None,
monkeypatch: pytest... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/basic_abilities/test_browse_website.py | test_browse_website | 25 | null | |
snap-stanford/MLAgentBench | import hashlib
import os
import re
from io import TextIOWrapper
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import autogpt.commands.file_operations as file_ops
from autogpt.agent.agent import Agent
from autogpt.memory.vector.memory_item import MemoryItem
from autogpt.memory.vector.uti... | expected_state | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_file_operations_state | 117 | null | |
snap-stanford/MLAgentBench | import functools
import hashlib
from pathlib import Path
from unittest.mock import patch
import pytest
from PIL import Image
from autogpt.agent.agent import Agent
from autogpt.commands.image_gen import generate_image, generate_image_with_sd_webui
from tests.utils import requires_api_key
def image_size(request):
... | delay) | assert_* | variable | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | test_huggingface_fail_request_with_delay | 153 | null | |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_missing_azure_config(config: Config, workspace: Workspace):
config_f... | FileNotFoundError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_missing_azure_config | 136 | null | |
snap-stanford/MLAgentBench | import os
import random
import string
import tempfile
from typing import Callable
import pytest
import autogpt.commands.execute_code as sut # system under testing
from autogpt.agent.agent import Agent
from autogpt.config import Config
def random_code(random_string) -> Callable:
return f"print('Hello {random_str... | f"Hello {random_string}!\n" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_execute_code.py | test_execute_python_file | 36 | null | |
snap-stanford/MLAgentBench | from autogpt.config.ai_config import AIConfig
def test_goals_are_always_lists_of_strings(tmp_path):
"""Test if the goals attribute is always a list of strings."""
yaml_content = """
ai_goals:
- Goal 1: Make a sandwich
- Goal 2, Eat the sandwich
- Goal 3 - Go to sleep
- "Goal 4: Wake up"
ai_name: McFamished
ai... | "Goal 3 - Go to sleep" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_goals_are_always_lists_of_strings | 30 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest import raises
from autogpt.url_utils.validators import validate_url
def dummy_method(url):
return url
class TestValidateUrl:
def test_happy_path_valid_url(self):
"""Test that the function successfully validates a valid URL with http:// or https:// prefix"""
@valida... | "https://www.google.com" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_url_validation.py | test_happy_path_valid_url | TestValidateUrl | 90 | null |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | [] | assert | collection | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_clear | 60 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | "1.0" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_version | 37 | null | |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | memory_item | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_add | 55 | null | |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_set_smart_llm_model(config: Config):
"""
Test if the set_smart_l... | "gpt-4-test" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_set_smart_llm_model | 76 | null | |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_initial_values(config: Config):
"""
Test if the initial values o... | "gpt-3.5-turbo" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_initial_values | 22 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | (600 * 0.0013 + 1200 * 0.0025) / 1000 | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_getter_methods | TestApiManager | 100 | null |
snap-stanford/MLAgentBench | from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_links
class TestScrapeLinks:
def test_valid_url(self, mocker, agent: Agent):
"""Test that the function returns correctly formatted hyperlinks when given a valid url."""
# Mock the requests.get() function to retu... | ["Google (https://www.google.com)"] | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_links.py | test_valid_url | TestScrapeLinks | 67 | null |
snap-stanford/MLAgentBench | import os
import random
import string
import tempfile
from typing import Callable
import pytest
import autogpt.commands.execute_code as sut # system under testing
from autogpt.agent.agent import Agent
from autogpt.config import Config
def random_code(random_string) -> Callable:
return f"print('Hello {random_str... | random_code | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/test_execute_code.py | test_execute_python_code | 50 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock
import pytest
from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
def agent(config: Config):
ai_name = "Test AI"
memory = MagicMock()
next_action_count = 0
command_registry = MagicMock()
ai_config = AICon... | "Test AI" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent.py | test_agent_initialization | 36 | null | |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_initializes_with_custom_values():
"""Tests that the spinner initializes with custom message and delay values."""
with Spinner(message=PLEASE_WAIT, delay=0.2) as spinner:
... | PLEASE_WAIT | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_initializes_with_custom_values | 41 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | completion_tokens | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_update_cost_completion_model | TestApiManager | 121 | null |
snap-stanford/MLAgentBench | import math
import time
from unittest.mock import MagicMock
import pytest
from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
from autogpt.llm.base import ChatSequence, Message
from autogpt.llm.providers.openai import OPEN_AI_CHAT_MODELS
from autogpt.llm.utils ... | Message( role="system", content="This reminds you of these events from your past: \n" + mock_summary_text, type=None, ) | assert | func_call | MLAgentBench/agents/Auto-GPT/tests/unit/test_message_history.py | test_message_history_batch_summary | 140 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommand:
def example_command_method(arg1: int, arg2: str) -> str:
"""Example function for testing the Command cla... | self.example_command_method | assert | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_creation | TestCommand | 33 | null |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | [mem4, mem1] | assert | collection | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get_relevant | 98 | null | |
snap-stanford/MLAgentBench | import json
import tempfile
from unittest import TestCase
from xml.etree import ElementTree
import docx
import yaml
from bs4 import BeautifulSoup
from autogpt.commands.file_operations_utils import is_file_binary_fn, read_textual_file
from autogpt.logs import logger
plain_text_str = "Hello, world!"
def mock_text_fil... | loaded_text) | self.assertIn | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_text_file_parsers.py | test_parsers | TestConfig | 148 | null |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_missing_azure_config(config: Config, workspace: Workspace):
config_f... | "azure" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_missing_azure_config | 142 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest import raises
from autogpt.url_utils.validators import validate_url
def dummy_method(url):
return url
@pytest.mark.parametrize("url", successful_test_data)
def test_url_validation_succeeds(url):
assert dummy_method(url) == | url | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_url_validation.py | test_url_validation_succeeds | 49 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock, patch
import pytest
from pytest_mock import MockerFixture
from autogpt.llm.api_manager import OPEN_AI_MODELS, ApiManager
api_manager = ApiManager()
def reset_api_manager():
api_manager.reset()
yield
def mock_costs(mocker: MockerFixture):
mocker.patch.multiple(
... | 600 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_getter_methods | TestApiManager | 98 | null |
snap-stanford/MLAgentBench | import os
import yaml
from autogpt.config.config import Config
from autogpt.plugins import inspect_zip_for_modules, scan_plugins
from autogpt.plugins.plugin_config import PluginConfig
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
PLUGIN_TEST_INIT_PY = "Aut... | { "a": {"enabled": True, "config": {}}, "b": {"enabled": True, "config": {}}, "c": {"enabled": False, "config": {}}, "d": {"enabled": False, "config": {}}, } | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_create_base_config | 85 | null | |
snap-stanford/MLAgentBench | from autogpt.agent import Agent
from autogpt.app import execute_command
def check_plan():
return "hi"
def test_execute_command_plugin(agent: Agent):
"""Test that executing a command that came from a plugin works as expected"""
agent.ai_config.prompt_generator.add_command(
"check_plan",
"Re... | "hi" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_execute_command.py | test_execute_command_plugin | 24 | null | |
snap-stanford/MLAgentBench | from unittest.mock import patch
import pytest
from autogpt.config.ai_config import AIConfig
from autogpt.setup import generate_aiconfig_automatic, prompt_user
from tests.utils import requires_api_key
@pytest.mark.vcr
@requires_api_key("OPENAI_API_KEY")
def test_generate_aiconfig_automatic_default(patched_api_request... | None | assert | none_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_setup.py | test_generate_aiconfig_automatic_default | 18 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.json_utils.json_fix_llm import fix_and_parse_json
def test_valid_json():
"""Test that a valid JSON string is parsed correctly."""
json_str = '{"name": "John", "age": 30, "city": "New York"}'
obj = fix_and_parse_json(json_str)
assert obj == | {"name": "John", "age": 30, "city": "New York"} | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/_test_json_parser.py | test_valid_json | 10 | null | |
snap-stanford/MLAgentBench | import os
import yaml
from autogpt.config.config import Config
from autogpt.plugins import inspect_zip_for_modules, scan_plugins
from autogpt.plugins.plugin_config import PluginConfig
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
PLUGIN_TEST_INIT_PY = "Aut... | 4 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_create_base_config | 75 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock
import pytest
from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
def agent(config: Config):
ai_name = "Test AI"
memory = MagicMock()
next_action_count = 0
command_registry = MagicMock()
ai_config = AICon... | agent.memory | assert | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent.py | test_agent_initialization | 37 | null | |
snap-stanford/MLAgentBench | import os
from unittest.mock import patch
import pytest
import requests
from autogpt.json_utils.utilities import extract_json_from_response, validate_json
from autogpt.utils import (
get_bulletin_from_web,
get_current_git_branch,
get_latest_bulletin,
readable_file_size,
validate_yaml_file,
)
from ... | "test-branch" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_get_current_git_branch_success | 177 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest import raises
from autogpt.url_utils.validators import validate_url
def dummy_method(url):
return url
class TestValidateUrl:
def test_general_behavior_additional_path_parameters_query_string(self):
"""Test that the function successfully validates a valid URL with additional... | "https://www.google.com/search?q=python" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_url_validation.py | test_general_behavior_additional_path_parameters_query_string | TestValidateUrl | 101 | null |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_updates_message_and_still_spins():
"""Tests that the spinner message can be updated while the spinner is running and the spinner continues spinning."""
with Spinner() as spin... | True | assert | bool_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_updates_message_and_still_spins | 58 | null | |
snap-stanford/MLAgentBench | import functools
import hashlib
from pathlib import Path
from unittest.mock import patch
import pytest
from PIL import Image
from autogpt.agent.agent import Agent
from autogpt.commands.image_gen import generate_image, generate_image_with_sd_webui
from tests.utils import requires_api_key
def image_size(request):
... | (image_size, image_size) | assert | collection | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | generate_and_validate | 106 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommand:
def example_command_method(arg1: int, arg2: str) -> str:
"""Example function for testing the Command cla... | "example" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_creation | TestCommand | 31 | null |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommandRegistry:
def example_command_method(arg1: int, arg2: str) -> str:
return f"{arg1} - {arg2}"
def test... | command_prompt | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_get_command_prompt | TestCommandRegistry | 162 | null |
snap-stanford/MLAgentBench | import json
import pytest
from googleapiclient.errors import HttpError
from autogpt.agent.agent import Agent
from autogpt.commands.google_search import (
google_official_search,
google_search,
safe_google_results,
)
def test_safe_google_results_invalid_input():
with pytest.raises( | AttributeError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_google_search.py | test_safe_google_results_invalid_input | 25 | null | |
snap-stanford/MLAgentBench | import pytest
from pytest_mock import MockerFixture
from autogpt.agent.agent import Agent
from autogpt.commands.web_selenium import browse_website
from tests.utils import requires_api_key
@pytest.mark.vcr
@requires_api_key("OPENAI_API_KEY")
def test_browse_website(agent: Agent, patched_api_requestor: MockerFixture):
... | 200 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_web_selenium.py | test_browse_website | 18 | null | |
snap-stanford/MLAgentBench | from unittest.mock import MagicMock
import pytest
from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
def agent(config: Config):
ai_name = "Test AI"
memory = MagicMock()
next_action_count = 0
command_registry = MagicMock()
ai_config = AICon... | agent.ai_config | assert | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent.py | test_agent_initialization | 41 | null | |
snap-stanford/MLAgentBench | from autogpt.config.ai_config import AIConfig
def test_goals_are_always_lists_of_strings(tmp_path):
"""Test if the goals attribute is always a list of strings."""
yaml_content = """
ai_goals:
- Goal 1: Make a sandwich
- Goal 2, Eat the sandwich
- Goal 3 - Go to sleep
- "Goal 4: Wake up"
ai_name: McFamished
ai... | "Goal 1: Make a sandwich" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_goals_are_always_lists_of_strings | 28 | null | |
snap-stanford/MLAgentBench | import pytest
import requests
from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_text
class TestScrapeText:
def test_no_text(self, mocker, agent: Agent):
"""Test that scrape_text returns an empty string when the html page contains no text to be scraped."""
# Mo... | "" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_text.py | test_no_text | TestScrapeText | 91 | null |
snap-stanford/MLAgentBench | from unittest import TestCase
from autogpt.prompts.generator import PromptGenerator
class TestPromptGenerator(TestCase):
def setUpClass(cls):
"""
Set up the initial state for each test method by creating an instance of PromptGenerator.
"""
cls.generator = PromptGenerator()
de... | self.generator.constraints) | self.assertIn | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_prompt_generator.py | test_add_constraint | TestPromptGenerator | 26 | null |
snap-stanford/MLAgentBench | import orjson
import pytest
from autogpt.config import Config
from autogpt.memory.vector import JSONFileMemory, MemoryItem
from autogpt.workspace import Workspace
from tests.utils import requires_api_key
def cleanup_sut_singleton():
if JSONFileMemory in JSONFileMemory._instances:
del JSONFileMemory._insta... | mem3 | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get_relevant | 97 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommand:
def example_command_method(arg1: int, arg2: str) -> str:
"""Example function for testing the Command cla... | "1 - test" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_call | TestCommand | 45 | null |
snap-stanford/MLAgentBench | import time
from autogpt.spinner import Spinner
ALMOST_DONE_MESSAGE = "Almost done..."
PLEASE_WAIT = "Please wait..."
def test_spinner_updates_message_and_still_spins():
"""Tests that the spinner message can be updated while the spinner is running and the spinner continues spinning."""
with Spinner() as spin... | ALMOST_DONE_MESSAGE | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_spinner.py | test_spinner_updates_message_and_still_spins | 62 | null | |
snap-stanford/MLAgentBench | from unittest import mock
from unittest.mock import patch
import pytest
from autogpt.config.config import Config
from autogpt.configurator import GPT_3_MODEL, GPT_4_MODEL, create_config
from autogpt.workspace.workspace import Workspace
def test_missing_azure_config(config: Config, workspace: Workspace):
config_f... | {} | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_missing_azure_config | 145 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommandRegistry:
def example_command_method(arg1: int, arg2: str) -> str:
return f"{arg1} - {arg2}"
def test... | "function_based" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_import_mock_commands_module | TestCommandRegistry | 172 | null |
snap-stanford/MLAgentBench | import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
generate_noise,
get_workspace_path,
r... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/memory/test_memory_challenge_c.py | test_memory_challenge_c | 66 | null | |
snap-stanford/MLAgentBench | import hashlib
import os
import re
from io import TextIOWrapper
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
import autogpt.commands.file_operations as file_ops
from autogpt.agent.agent import Agent
from autogpt.memory.vector.memory_item import MemoryItem
from autogpt.memory.vector.uti... | None | assert | none_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_text_checksum | 180 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.logs import remove_color_codes
@pytest.mark.parametrize(
"raw_text, clean_text",
[
(
"COMMAND = \x1b[36mbrowse_website\x1b[0m ARGUMENTS = \x1b[36m{'url': 'https://www.google.com', 'question': 'What is the capital of France?'}\x1b[0m",
"COMMAND = brow... | clean_text | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_logs.py | test_remove_color_codes | 28 | null | |
snap-stanford/MLAgentBench | import os
import yaml
from autogpt.config.config import Config
from autogpt.plugins import inspect_zip_for_modules, scan_plugins
from autogpt.plugins.plugin_config import PluginConfig
PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"
PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"
PLUGIN_TEST_INIT_PY = "Aut... | 1 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_scan_plugins_openai | 24 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.agent.agent_manager import AgentManager
from autogpt.llm.chat import create_chat_completion
def agent_manager():
# Hack, real gross. Singletons are not good times.
yield AgentManager()
del AgentManager._instances[AgentManager]
def task():
return "translate English to French... | agent_manager.agents | assert | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent_manager.py | test_create_agent | 43 | null | |
snap-stanford/MLAgentBench | import os
import random
import string
import tempfile
from typing import Callable
import pytest
import autogpt.commands.execute_code as sut # system under testing
from autogpt.agent.agent import Agent
from autogpt.config import Config
def random_code(random_string) -> Callable:
return f"print('Hello {random_str... | result | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/test_execute_code.py | test_execute_shell | 91 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def dummy_plugin():
"""A dummy plugin for testing purposes."""
manifests_specs_clients = {
"manifest": {
"name_for_model": "Dummy",
"schema_version": "1.0",
"description_for_model": "A dum... | "A dummy plugin for testing purposes" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/models/test_base_open_api_plugin.py | test_dummy_plugin_description | 42 | null | |
snap-stanford/MLAgentBench | import os
import shutil
import sys
from pathlib import Path
import pytest
from autogpt.commands.command import Command, CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommand:
def example_command_method(arg1: int, arg2: str) -> str:
"""Example function for testing the Command cla... | TypeError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_call_with_invalid_arguments | TestCommand | 55 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.