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 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... | True | assert | bool_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_is_duplicate_operation | 129 | 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... | [] | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent.py | test_agent_initialization | 38 | 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... | custom_signature | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_custom_signature | TestCommand | 67 | 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):
... | "Error creating image." | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | test_huggingface_fail_request_with_delay | 175 | 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.commands) | self.assertIn | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_prompt_generator.py | test_add_command | TestPromptGenerator | 43 | 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 ... | False | assert | bool_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_validate_yaml_file_not_found | 62 | 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 mock_googleapiclient(mocker):
mock_build = mocker.patch("googleapiclient.discover... | safe_google_results(expected_output) | assert | func_call | MLAgentBench/agents/Auto-GPT/tests/unit/test_google_search.py | test_google_official_search | 92 | 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):
... | 0) | assert_* | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | test_huggingface_fail_request_with_delay | 178 | 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 | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_ai_config_file_not_exists | 54 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.json_utils.json_fix_llm import fix_and_parse_json
def test_invalid_json_minor():
"""Test that an invalid JSON string can be fixed with gpt."""
json_str = '{"name": "John", "age": 30, "city": "New York",}'
assert fix_and_parse_json(json_str, try_to_fix_with_gpt=False) == | { "name": "John", "age": 30, "city": "New York", } | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/_test_json_parser.py | test_invalid_json_minor | 16 | 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_fallback(patched_api_reques... | "Chef-GPT" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/integration/test_setup.py | test_generate_aiconfig_automatic_fallback | 51 | 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 ... | message | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_validate_yaml_file_valid | 56 | 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 ... | valid_json_response | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_extract_json_from_response | 198 | null | |
snap-stanford/MLAgentBench | import pytest
import yaml
from pytest_mock import MockerFixture
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 ... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/kubernetes/test_kubernetes_template_challenge_a.py | test_kubernetes_template_challenge_a | 39 | 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... | size | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_download_file | 388 | 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... | 1 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/challenges/test_challenge_should_be_formatted_properly.py | assert_single_test_function | 47 | 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 command" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_command_creation | TestCommand | 32 | 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 * 0.0013 + 20 * 0.0025) / 1000 | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_create_chat_completion_valid_inputs | TestApiManager | 92 | 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_b.py | test_memory_challenge_b | 49 | 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... | new_content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_write_to_file | 212 | 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... | False | assert | bool_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_is_duplicate_operation | 135 | 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.resources) | self.assertIn | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_prompt_generator.py | test_add_resource | TestPromptGenerator | 51 | 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.0 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_getter_methods | TestApiManager | 101 | null |
snap-stanford/MLAgentBench | from autogpt.config.prompt_config import PromptConfig
def test_prompt_config_loading(tmp_path):
"""Test if the prompt configuration loads correctly"""
yaml_content = """
constraints:
- A test constraint
- Another test constraint
- A third test constraint
resources:
- A test resource
- Another test resource
- ... | "A test constraint" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_prompt_config.py | test_prompt_config_loading | 32 | 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... | {"api_key": "1234"} | assert | collection | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_load_config | 109 | 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 ... | expected_call_count | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_message_history.py | test_message_history_batch_summary | 137 | null | |
snap-stanford/MLAgentBench | import itertools
from pathlib import Path
import pytest
from autogpt.workspace import Workspace
_WORKSPACE_ROOT = Path("home/users/monty/auto_gpt_workspace")
_ACCESSIBLE_PATHS = [
Path("."),
Path("test_file.txt"),
Path("test_folder"),
Path("test_folder/test_file.txt"),
Path("test_folder/.."),
... | ValueError) | pytest.raises | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_workspace.py | test_sanitize_path_inaccessible | 81 | 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... | 0 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_agent.py | test_agent_initialization | 39 | null | |
snap-stanford/MLAgentBench | import pytest
from autogpt.json_utils.json_fix_llm import fix_and_parse_json
def test_invalid_json_leading_sentence_with_gpt():
"""Test that a REALLY invalid JSON string raises an error when try_to_fix_with_gpt is False."""
json_str = """I suggest we start by browsing the repository to find any issues that w... | good_obj | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/_test_json_parser.py | test_invalid_json_leading_sentence_with_gpt | 76 | 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.""... | 3 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_links.py | test_scrape_links_with_few_hyperlinks | TestScrapeLinks | 116 | null |
snap-stanford/MLAgentBench | import contextlib
import pytest
from pytest_mock import MockerFixture
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... | content | assert | variable | MLAgentBench/agents/Auto-GPT/tests/challenges/information_retrieval/test_information_retrieval_challenge_b.py | test_information_retrieval_challenge_b | 43 | 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_gpt_4():
messages = [
Message("user", "Hello"),
Message("assistant", "Hi there!"),
]
assert count_message_tokens(messages, model="gpt-4-... | 15 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_token_counter.py | test_count_message_tokens_gpt_4 | 35 | 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... | None | assert | none_literal | MLAgentBench/agents/Auto-GPT/tests/challenges/test_challenge_should_be_formatted_properly.py | load_module_from_file | 29 | 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_empty_input():
"""Test that the string tokens are counted correctly."""
assert count_string_tokens("", model_name="gpt-3.5-turbo-0301") == | 0 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_token_counter.py | test_count_string_tokens_empty_input | 48 | 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_create_config_gpt4only(config: Config) -> None:
fast_llm_model = con... | GPT_4_MODEL | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_config.py | test_create_config_gpt4only | 169 | 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 ... | "3.50 MB" | assert | string_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_readable_file_size | 83 | 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):
... | neg_image_hash | assert | variable | MLAgentBench/agents/Auto-GPT/tests/integration/test_image_gen.py | test_sd_webui_negative_prompt | 82 | 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_unreachable_url(self, mocker, agent: Agent):
"""Test that scrape_text returns an error message when an invalid or unreachable url is provided."""
... | error_message | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_text.py | test_unreachable_url | TestScrapeText | 79 | 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(
... | 1200 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_api_manager.py | test_getter_methods | TestApiManager | 99 | 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 ... | bulletin | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_utils.py | test_get_bulletin_from_web_success | 94 | 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... | registry.commands | assert | complex_expr | MLAgentBench/agents/Auto-GPT/tests/unit/test_commands.py | test_register_command | TestCommandRegistry | 87 | 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... | os.path.basename(test_file)[5:-3] | assert | func_call | MLAgentBench/agents/Auto-GPT/tests/challenges/test_challenge_should_be_formatted_properly.py | assert_single_test_function | 48 | 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 | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_file_operations.py | test_file_operations_log | 96 | 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,
)
@pytest.mark.parametrize(
"query, expected_output",
[("test", "test"), (["test1",... | expected_output | assert | variable | MLAgentBench/agents/Auto-GPT/tests/unit/test_google_search.py | test_safe_google_results | 21 | 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 == ""
assert... | 0.0 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_ai_config.py | test_ai_config_file_not_exists | 57 | 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... | None | assert | none_literal | MLAgentBench/agents/Auto-GPT/tests/integration/memory/test_json_file_memory.py | test_json_memory_get | 71 | 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... | 2 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_plugins.py | test_scan_plugins_generic | 39 | null | |
snap-stanford/MLAgentBench | from autogpt.agent.agent import Agent
from autogpt.commands.web_requests import scrape_links
class TestScrapeLinks:
def test_valid_url_with_hyperlinks(self, agent: Agent):
url = "https://www.google.com"
result = scrape_links(url, agent=agent)
assert len(result) > | 0 | assert | numeric_literal | MLAgentBench/agents/Auto-GPT/tests/unit/test_browse_scrape_links.py | test_valid_url_with_hyperlinks | TestScrapeLinks | 49 | null |
copier-org/copier | import os
import shutil
from collections.abc import Callable, Iterator, Sequence
from pathlib import Path
import pytest
from packaging.version import Version
from plumbum import local
from pytest_gitconfig.plugin import GitConfig
from copier import run_copy, run_update
from copier._main import Worker
from copier._use... | "hello world" | assert | string_literal | tests/test_vcs.py | test_local_dirty_clone | 114 | null | |
copier-org/copier | import os
import re
from pathlib import Path
from tempfile import gettempdir
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier.errors import DirtyLocalWarning, ForbiddenPathError
from .helpers import build_file_tree, git
@pytest.mark.xfail(
os.name == "nt", reason="Abso... | "outside" | assert | string_literal | tests/test_symlinks.py | test_symlinked_to_outside_destination_absolute | 500 | null | |
copier-org/copier | from pathlib import Path
import pytest
from copier._cli import CopierApp
from copier._main import run_copy, run_recopy, run_update
from .helpers import build_file_tree, git
def template_path(tmp_path_factory: pytest.TempPathFactory) -> str:
# V1 of the template
root = tmp_path_factory.mktemp("template")
... | "Copier" | assert | string_literal | tests/test_tmpdir.py | test_api | 53 | null | |
copier-org/copier | from __future__ import annotations
import platform
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
from typing import Any, Protocol, TypeAlias
import pexpect
import pytest
import yaml
from coverage.tracer import CTracer
from pexpect.popen_spawn import PopenSpawn
from plumbum ... | values[1:] | assert | complex_expr | tests/test_prompt.py | test_multiselect_choices_question_with_default | 1,064 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | "version 2\nhello\na1\nbye\n" | assert | string_literal | tests/test_subdirectory.py | test_update_subdirectory_from_root_path | 177 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections import deque
from pathlib import Path
from textwrap import dedent
import pexpect
import pytest
import yaml
from pexpect.popen_spawn import PopenSpawn
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_an... | answers2 | assert | variable | tests/test_complex_questions.py | test_multi_template_answers | 580 | null | |
copier-org/copier | from __future__ import annotations
import json
from pathlib import Path
from textwrap import dedent
import pytest
import yaml
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git_save
def template_path(tmp_path_factory: pytest... | "äöü" | assert | string_literal | tests/test_answersfile.py | test_external_data_with_umlaut | 253 | null | |
copier-org/copier | import json
import platform
from pathlib import Path
from shutil import copytree
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_answersfile_data
from copier.errors import UserMessageError
from .helpers import BRACKET_ENVOPS_JSON, PROJECT_TEMPLATE, b... | "v1.0.0" | assert | string_literal | tests/test_legacy_migration.py | test_prereleases | 220 | null | |
copier-org/copier | import pexpect
import pytest
from plumbum import local
from pytest import TempPathFactory
import copier
from .helpers import COPIER_PATH, Spawn, build_file_tree, expect_prompt, git
def test_render_conditional(tmp_path_factory: TempPathFactory) -> None:
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
... | "This is True." | assert | string_literal | tests/test_conditional_file_name.py | test_render_conditional | 21 | null | |
copier-org/copier | from __future__ import annotations
import platform
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
from typing import Any, Protocol, TypeAlias
import pexpect
import pytest
import yaml
from coverage.tracer import CTracer
from pexpect.popen_spawn import PopenSpawn
from plumbum ... | 3.0 | assert | numeric_literal | tests/test_prompt.py | test_update_choice | 696 | null | |
copier-org/copier | from __future__ import annotations
from pathlib import Path
import pytest
import copier
from copier._user_data import load_answersfile_data
from .helpers import build_file_tree
def template_path(tmp_path_factory: pytest.TempPathFactory) -> str:
root = tmp_path_factory.mktemp("template")
build_file_tree(
... | "anothermodule" | assert | string_literal | tests/test_answersfile_templating.py | test_answersfile_templating | 75 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections.abc import Callable
from pathlib import Path
from textwrap import dedent
from typing import Any
import pytest
from plumbum import local
from pydantic import ValidationError
import copier
from copier._main import Worker
from copier._template import DEFAU... | ("exclude1", "exclude2") | assert | collection | tests/test_config.py | test_config_data_is_loaded_from_file | 36 | null | |
copier-org/copier | import json
import sys
from pathlib import Path
from uuid import uuid4
import pytest
from plumbum import local
import copier
from .helpers import build_file_tree, git_save
def test_task_templating_with_operation(
tmp_path_factory: pytest.TempPathFactory, tmp_path: Path
) -> None:
"""
Ensure that it is p... | 1 | assert | numeric_literal | tests/test_context.py | test_task_templating_with_operation | 182 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | "2" | assert | string_literal | tests/test_subdirectory.py | test_update_subdirectory_from_root_path | 176 | null | |
copier-org/copier | import os
import re
from pathlib import Path
from tempfile import gettempdir
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier.errors import DirtyLocalWarning, ForbiddenPathError
from .helpers import build_file_tree, git
def test_update_file_to_symlink(tmp_path_factory: pyt... | "Lorem ipsum" | assert | string_literal | tests/test_symlinks.py | test_update_file_to_symlink | 339 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
import pytest
from plumbum import local
from copier import run_copy, run_recopy
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from copier._vcs import get_git
from .helpers import build_file_tree, git_save
def tpl(tmp_path_f... | "This is your name: Peach." | assert | string_literal | tests/test_recopy.py | test_recopy_discards_evolution_cli | 50 | null | |
copier-org/copier | from pathlib import Path
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_answersfile_data
from copier.errors import UnsafeTemplateError, UserMessageError
from .helpers import (
COPIER_ANSWERS_FILE,
PROJECT_TEMPLATE,
build_file_tree,
g... | with_version | assert | variable | tests/test_migrations.py | test_migration_env_variables | 458 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections import deque
from pathlib import Path
from textwrap import dedent
import pexpect
import pytest
import yaml
from pexpect.popen_spawn import PopenSpawn
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_an... | dedent( """\ love_me: true your_name: "Guybrush Threpwood" your_age: 22 your_height: 1.56 more_json_info: {"objective": "be a pirate"} anything_else: ["Want some grog?", "I\\u0027d love it"] choose_list: "first" choose_tuple: "second" choose_dict: "third" choose_number: -1.1 minutes_under_water: 1 optional_value: null ... | assert | func_call | tests/test_complex_questions.py | test_cli_interactive | 254 | null | |
copier-org/copier | from __future__ import annotations
import platform
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
from typing import Any, Protocol, TypeAlias
import pexpect
import pytest
import yaml
from coverage.tracer import CTracer
from pexpect.popen_spawn import PopenSpawn
from plumbum ... | values | assert | variable | tests/test_prompt.py | test_update_multiselect_choices | 1,107 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | "version 1\nhello\na1\nbye\n" | assert | string_literal | tests/test_subdirectory.py | test_update_subdirectory_from_root_path | 165 | null | |
copier-org/copier | from __future__ import annotations
import os
import platform
from pathlib import Path
import pytest
import yaml
from copier._settings import SettingsModel
from copier.errors import MissingSettingsWarning
@pytest.mark.skipif(platform.system() != "Windows", reason="Windows-only test")
def test_default_windows_setting... | Path( os.getenv("USERPROFILE", default=""), "AppData", "Local", "copier", "settings.yml", ) | assert | func_call | tests/test_settings_deprecated.py | test_default_windows_settings_path | 32 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections.abc import Callable
from pathlib import Path
from textwrap import dedent
from typing import Any
import pytest
from plumbum import local
from pydantic import ValidationError
import copier
from copier._main import Worker
from copier._template import DEFAU... | err | assert | variable | tests/test_config.py | test_invalid_yaml | 160 | null | |
copier-org/copier | import warnings
import pytest
import copier
from .helpers import build_file_tree
def test_normal_jinja2(tmp_path_factory: pytest.TempPathFactory) -> None:
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
build_file_tree(
{
(src / "copier.yml"): (
"""\
... | expected | assert | variable | tests/test_normal_jinja2.py | test_normal_jinja2 | 49 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections.abc import Sequence
from datetime import datetime
import pexpect
import pytest
import yaml
from pexpect.popen_spawn import PopenSpawn
from plumbum import local
from copier._main import Worker
from copier._types import AnyByStrDict
from copier._user_data... | returns | assert | variable | tests/test_templated_prompt.py | test_templated_prompt_invalid | 282 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
import pytest
from plumbum import local
from copier import run_copy, run_recopy
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from copier._vcs import get_git
from .helpers import build_file_tree, git_save
def tpl(tmp_path_f... | "This is your name: Mario." | assert | string_literal | tests/test_recopy.py | test_recopy_works_without_replay | 65 | null | |
copier-org/copier | from __future__ import annotations
import filecmp
import os
import platform
import re
import stat
import sys
from contextlib import AbstractContextManager, nullcontext as does_not_raise
from decimal import Decimal
from enum import Enum
from pathlib import Path
from textwrap import dedent, indent
from time import sleep... | control | assert | variable | tests/test_copy.py | test_copy | 184 | null | |
copier-org/copier | from __future__ import annotations
import platform
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
from typing import Any, Protocol, TypeAlias
import pexpect
import pytest
import yaml
from coverage.tracer import CTracer
from pexpect.popen_spawn import PopenSpawn
from plumbum ... | 1 | assert | numeric_literal | tests/test_prompt.py | test_interactive_session_required_for_question_prompt | 1,173 | null | |
copier-org/copier | from pathlib import Path
from stat import S_IREAD
from tempfile import TemporaryDirectory
import pytest
from poethepoet.app import PoeThePoet
from copier._tools import normalize_git_path
from .helpers import git
def test_types() -> None:
"""Ensure source code static typing."""
result = PoeThePoet(Path())(["... | 0 | assert | numeric_literal | tests/test_tools.py | test_types | 16 | null | |
copier-org/copier | import os
import re
from pathlib import Path
from tempfile import gettempdir
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier.errors import DirtyLocalWarning, ForbiddenPathError
from .helpers import build_file_tree, git
def test_update_file_to_symlink(tmp_path_factory: pyt... | Path("aaaa.txt") | assert | func_call | tests/test_symlinks.py | test_update_file_to_symlink | 337 | null | |
copier-org/copier | from __future__ import annotations
import os
import platform
from collections.abc import Sequence
from pathlib import Path
import pytest
import yaml
from copier import Settings, load_settings, run_copy
from copier._settings import _default_settings_path, is_trusted_repository
from copier.errors import MissingSetting... | Path( os.getenv("USERPROFILE", default=""), "AppData", "Local", "copier", "settings.yml", ) | assert | func_call | tests/test_settings.py | test_default_windows_settings_path | 34 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
import pytest
from plumbum import local
from copier import run_copy, run_recopy
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from copier._vcs import get_git
from .helpers import build_file_tree, git_save
def tpl(tmp_path_f... | answers | assert | variable | tests/test_recopy.py | test_recopy_dont_validate_computed_value | 128 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | "downstream version 1\n" | assert | string_literal | tests/test_subdirectory.py | test_new_version_changes_subdirectory | 331 | null | |
copier-org/copier | from __future__ import annotations
import platform
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
from typing import Any, Protocol, TypeAlias
import pexpect
import pytest
import yaml
from coverage.tracer import CTracer
from pexpect.popen_spawn import PopenSpawn
from plumbum ... | "string" | assert | string_literal | tests/test_prompt.py | test_var_name_value_allowed | 826 | null | |
copier-org/copier | import json
import platform
from pathlib import Path
from shutil import copytree
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_answersfile_data
from copier.errors import UserMessageError
from .helpers import BRACKET_ENVOPS_JSON, PROJECT_TEMPLATE, b... | {"_commit": "v1.0.0", "_src_path": str(src)} | assert | collection | tests/test_legacy_migration.py | test_migrations_and_tasks | 62 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections.abc import Sequence
from datetime import datetime
import pexpect
import pytest
import yaml
from pexpect.popen_spawn import PopenSpawn
from plumbum import local
from copier._main import Worker
from copier._types import AnyByStrDict
from copier._user_data... | expected_value | assert | variable | tests/test_templated_prompt.py | test_templated_prompt | 186 | null | |
copier-org/copier | from __future__ import annotations
import json
from collections.abc import Callable
from pathlib import Path
from textwrap import dedent
from typing import Any
import pytest
from plumbum import local
from pydantic import ValidationError
import copier
from copier._main import Worker
from copier._template import DEFAU... | tmp_path.name | assert | complex_expr | tests/test_config.py | test_worker_good_data | 356 | null | |
copier-org/copier | from pathlib import Path
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_answersfile_data
from copier.errors import UnsafeTemplateError, UserMessageError
from .helpers import (
COPIER_ANSWERS_FILE,
PROJECT_TEMPLATE,
build_file_tree,
g... | "v1.9" | assert | string_literal | tests/test_migrations.py | test_prerelease_version_migration | 164 | null | |
copier-org/copier | import os
import re
from pathlib import Path
from tempfile import gettempdir
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier.errors import DirtyLocalWarning, ForbiddenPathError
from .helpers import build_file_tree, git
def test_symlinked_dir_expanded(tmp_path_factory: pyt... | "some content" | assert | string_literal | tests/test_symlinks.py | test_symlinked_dir_expanded | 463 | null | |
copier-org/copier | import warnings
from pathlib import Path
import pytest
from packaging.version import Version
from plumbum import local
import copier
from copier.errors import (
OldTemplateWarning,
UnknownCopierVersionWarning,
UnsupportedVersionError,
)
from .helpers import build_file_tree, git
def template_path(tmp_pat... | OldTemplateWarning) | pytest.raises | variable | tests/test_minimum_version.py | test_version_bigger_major_warning | 102 | null | |
copier-org/copier | import json
import platform
from pathlib import Path
from shutil import copytree
import pytest
from plumbum import local
from copier import run_copy, run_update
from copier._user_data import load_answersfile_data
from copier.errors import UserMessageError
from .helpers import BRACKET_ENVOPS_JSON, PROJECT_TEMPLATE, b... | "v2" | assert | string_literal | tests/test_legacy_migration.py | test_pre_migration_modifies_answers | 167 | null | |
copier-org/copier | from __future__ import annotations
import json
from pathlib import Path
from textwrap import dedent
import pytest
import yaml
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git_save
def template_path(tmp_path_factory: pytest... | data["foo"] | assert | complex_expr | tests/test_answersfile.py | test_external_data_with_unicode_characters | 301 | null | |
copier-org/copier | import json
import sys
from pathlib import Path
from uuid import uuid4
import pytest
from plumbum import local
import copier
from .helpers import build_file_tree, git_save
def test_exclude_templating_with_operation(
tmp_path_factory: pytest.TempPathFactory,
) -> None:
"""
Ensure it's possible to create ... | "foo" | assert | string_literal | tests/test_context.py | test_exclude_templating_with_operation | 108 | null | |
copier-org/copier | from __future__ import annotations
from contextlib import AbstractContextManager, nullcontext as does_not_raise
from pathlib import Path
import pytest
import yaml
from jinja2.ext import Extension
from plumbum import local
from copier._cli import CopierApp
from copier._main import run_copy, run_update
from copier._ty... | err | assert | variable | tests/test_unsafe.py | test_update_cli | 418 | null | |
copier-org/copier | from __future__ import annotations
import subprocess
import sys
from collections.abc import Callable, Generator
from pathlib import Path
import pytest
import yaml
from plumbum import local
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from .helpers import COPIER_CMD, build_fi... | str(src) | assert | func_call | tests/test_cli.py | test_cli_data_parsed_by_question_type | 130 | null | |
copier-org/copier | from __future__ import annotations
import os
import platform
from pathlib import Path
import pytest
import yaml
from copier._settings import SettingsModel
from copier.errors import MissingSettingsWarning
def test_settings_from_env_location(
settings_path: Path, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) ... | {"foo": "baz"} | assert | collection | tests/test_settings_deprecated.py | test_settings_from_env_location | 60 | null | |
copier-org/copier | from __future__ import annotations
import os
import platform
from pathlib import Path
import pytest
import yaml
from copier._settings import SettingsModel
from copier.errors import MissingSettingsWarning
@pytest.mark.parametrize(
("repository", "trust", "is_trusted"),
[
("https://github.com/user/rep... | is_trusted | assert | variable | tests/test_settings_deprecated.py | test_is_trusted | 145 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | expect_reject | assert | variable | tests/test_subdirectory.py | test_new_version_uses_subdirectory | 270 | null | |
copier-org/copier | from unittest.mock import Mock, patch
import pytest
from copier._main import Worker
from copier.errors import CopierAnswersInterrupt
from .helpers import build_file_tree
def test_multiple_questions_interrupt(tmp_path_factory: pytest.TempPathFactory) -> None:
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"... | worker.template | assert | complex_expr | tests/test_interrupts.py | test_multiple_questions_interrupt | 74 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
import pytest
from plumbum import local
from copier import run_copy, run_recopy
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from copier._vcs import get_git
from .helpers import build_file_tree, git_save
def tpl(tmp_path_f... | True | assert | bool_literal | tests/test_recopy.py | test_recopy_with_skip_answered_and_new_answer | 100 | null | |
copier-org/copier | from pathlib import Path
from shutil import copy2, copytree
import pytest
from plumbum import local
from pytest_gitconfig.plugin import GitConfig
import copier
from copier._main import run_copy, run_update
from copier.errors import DirtyLocalWarning, UserMessageError
from .helpers import DATA, PROJECT_TEMPLATE, buil... | p2.read_text() | assert | func_call | tests/test_dirty_local.py | test_update | 148 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
from typing import Literal
import pytest
from plumbum import local
import copier
from copier._user_data import load_answersfile_data
from .helpers import BRACKET_ENVOPS_JSON, SUFFIX_TMPL, build_file_tree, git, git_init
def template_path(tmp_path_factory: pytest.T... | "v2" | assert | string_literal | tests/test_subdirectory.py | test_new_version_uses_subdirectory | 263 | null | |
copier-org/copier | from pathlib import Path
from textwrap import dedent
import pytest
from plumbum import local
from copier import run_copy, run_recopy
from copier._cli import CopierApp
from copier._user_data import load_answersfile_data
from copier._vcs import get_git
from .helpers import build_file_tree, git_save
def tpl(tmp_path_f... | "This is your name: Luigi." | assert | string_literal | tests/test_recopy.py | test_recopy_discards_evolution_api | 36 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.