repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/error_handler_test.py | test_error_handler_no_tty | assert | string_literal | 38 | from __future__ import annotations
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cm... | f'Check the log at {log_file}' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/clientlib_test.py | test_migrate_sha_to_rev_dont_specify_both | assert | string_literal | 34 | from __future__ import annotations
import logging
import re
import cfgv
import pytest
import pre_commit.constants as C
from pre_commit.clientlib import check_type_tag
from pre_commit.clientlib import CONFIG_HOOK_DICT
from pre_commit.clientlib import CONFIG_REPO_DICT
from pre_commit.clientlib import CONFIG_SCHEMA
fro... | 'Cannot specify both sha and rev' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/migrate_config_test.py | test_migrate_config_normal_format | assert | string_literal | 20 | from __future__ import annotations
import pre_commit.constants as C
from pre_commit.commands.migrate_config import migrate_config
def test_migrate_config_normal_format(tmpdir, capsys):
cfg = tmpdir.join(C.CONFIG_FILE)
cfg.write(
'- repo: local\n'
' hooks:\n'
' - id: foo\n'
... | 'Configuration has been migrated.\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/migrate_config_test.py | test_already_migrated_configuration_noop | assert | string_literal | 22 | from __future__ import annotations
import pre_commit.constants as C
from pre_commit.commands.migrate_config import migrate_config
def test_already_migrated_configuration_noop(tmpdir, capsys):
contents = (
'repos:\n'
'- repo: local\n'
' hooks:\n'
' - id: foo\n'
' ... | 'Configuration is already migrated.\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/logging_handler_test.py | test_logging_handler_color | assert | string_literal | 16 | from __future__ import annotations
import logging
from pre_commit import color
from pre_commit.logging_handler import LoggingHandler
def _log_record(message, level):
return logging.LogRecord('name', level, '', 1, message, {}, None)
def test_logging_handler_color(cap_out):
handler = LoggingHandler(True)
... | f'{color.YELLOW}[WARNING]{color.NORMAL} hi\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/error_handler_test.py | test_error_handler_no_tty | assert | string_literal | 37 | from __future__ import annotations
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cm... | 'An unexpected error has occurred: ValueError: ☃' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/error_handler_test.py | test_log_and_exit | assert | string_literal | 36 | from __future__ import annotations
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cm... | f'msg: FatalError: hai\nCheck the log at {log_file}\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/init_templatedir_test.py | test_init_templatedir | assert | string_literal | 24 | from __future__ import annotations
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.commands.init_templatedir import init_templatedir
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from testing.fixtures import git_dir
from te... | '[WARNING] `init.templateDir` not set to the target directory' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/try_repo_test.py | test_try_repo_uncommitted_changes | assert | string_literal | 53 | from __future__ import annotations
import os.path
import re
import time
from unittest import mock
import re_assert
from pre_commit import git
from pre_commit.commands.try_repo import try_repo
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.fixtures import git_d... | '[WARNING] Creating temporary repo with uncommitted changes...\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/try_repo_test.py | test_try_repo_uncommitted_changes | assert | string_literal | 62 | from __future__ import annotations
import os.path
import re
import time
from unittest import mock
import re_assert
from pre_commit import git
from pre_commit.commands.try_repo import try_repo
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.fixtures import git_d... | 'modified name!...........................................................Passed\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/util_test.py | test_CalledProcessError_str_nooutput | assert | string_literal | 22 | from __future__ import annotations
import os.path
import stat
import subprocess
import pytest
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b
from pre_commit.util import cmd_output_p
from ... | "command: ('exe',)\n" 'return code: 1\n' 'expected return code: 0\n' 'stdout: (none)\n' 'stderr: (none)' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/try_repo_test.py | test_try_repo_with_specific_hook | assert | string_literal | 53 | from __future__ import annotations
import os.path
import re
import time
from unittest import mock
import re_assert
from pre_commit import git
from pre_commit.commands.try_repo import try_repo
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.fixtures import git_d... | '''\ Bash hook............................................(no files to check)Skipped - hook id: bash_hook ''' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/util_test.py | test_CalledProcessError_str | assert | string_literal | 22 | from __future__ import annotations
import os.path
import stat
import subprocess
import pytest
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b
from pre_commit.util import cmd_output_p
from ... | "command: ('exe',)\n" 'return code: 1\n' 'expected return code: 0\n' 'stdout:\n' ' output\n' 'stderr:\n' ' errors' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/migrate_config_test.py | test_migrate_config_normal_format | assert | string_literal | 22 | from __future__ import annotations
import pre_commit.constants as C
from pre_commit.commands.migrate_config import migrate_config
def test_migrate_config_normal_format(tmpdir, capsys):
cfg = tmpdir.join(C.CONFIG_FILE)
cfg.write(
'- repo: local\n'
' hooks:\n'
' - id: foo\n'
... | 'repos:\n' '- repo: local\n' ' hooks:\n' ' - id: foo\n' ' name: foo\n' ' entry: ./bin/foo.sh\n' ' language: script\n' | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/helpers_test.py | test_assert_no_additional_deps | assert | string_literal | 34 | from __future__ import annotations
import multiprocessing
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessErro... | 'for now, pre-commit does not support additional_dependencies for ' 'lang -- ' "you selected `additional_dependencies: ['hmmm']`" | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/color_test.py | test_use_color_always | assert | bool_literal | 15 | from __future__ import annotations
import sys
from unittest import mock
import pytest
from pre_commit import envcontext
from pre_commit.color import format_color
from pre_commit.color import GREEN
from pre_commit.color import use_color
def test_use_color_always():
assert use_color('always') is | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/hook_impl_test.py | test_run_ns_pre_commit | assert | bool_literal | 26 | from __future__ import annotations
import subprocess
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands import hook_impl
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from pre_commit.util import... | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/git_test.py | test_is_in_merge_conflict | assert | bool_literal | 14 | from __future__ import annotations
import os.path
import pytest
from pre_commit import git
from pre_commit.error_handler import FatalError
from pre_commit.util import cmd_output
from testing.util import git_commit
def test_is_in_merge_conflict(in_merge_conflict):
assert git.is_in_merge_conflict() is | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/docker_test.py | test_in_docker_docker_in_file | assert | bool_literal | 60 | from __future__ import annotations
import builtins
import json
import ntpath
import os.path
import posixpath
from unittest import mock
import pytest
from pre_commit.languages import docker
from pre_commit.util import CalledProcessError
DOCKER_CGROUP_EXAMPLE = b'''\
12:hugetlb:/docker/c33988ec7651ebc867cb24755eaf637... | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/helpers_test.py | test_exe_exists_exists | assert | bool_literal | 32 | from __future__ import annotations
import multiprocessing
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessErro... | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/python_test.py | test_healthy_default_creator | assert | bool_literal | 30 | from __future__ import annotations
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.envcontext import envcontext
from pre_commit.languages import python
from pre_commit.prefix import Prefix
from pre_commit.util import make_executable
from pre_commit.u... | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/main_test.py | test_init_templatedir | assert | bool_literal | 55 | from __future__ import annotations
import argparse
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import main
from pre_commit.errors import FatalError
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.util ... | True | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/color_test.py | test_use_color_never | assert | bool_literal | 15 | from __future__ import annotations
import sys
from unittest import mock
import pytest
from pre_commit import envcontext
from pre_commit.color import format_color
from pre_commit.color import GREEN
from pre_commit.color import use_color
def test_use_color_never():
assert use_color('never') is | False | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/git_test.py | test_is_not_in_merge_conflict | assert | bool_literal | 14 | from __future__ import annotations
import os.path
import pytest
from pre_commit import git
from pre_commit.error_handler import FatalError
from pre_commit.util import cmd_output
from testing.util import git_commit
def test_is_not_in_merge_conflict(in_git_dir):
assert git.is_in_merge_conflict() is | False | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/docker_test.py | test_in_docker_no_file | assert | bool_literal | 52 | from __future__ import annotations
import builtins
import json
import ntpath
import os.path
import posixpath
from unittest import mock
import pytest
from pre_commit.languages import docker
from pre_commit.util import CalledProcessError
DOCKER_CGROUP_EXAMPLE = b'''\
12:hugetlb:/docker/c33988ec7651ebc867cb24755eaf637... | False | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/helpers_test.py | test_exe_exists_does_not_exist | assert | bool_literal | 32 | from __future__ import annotations
import multiprocessing
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessErro... | False | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/python_test.py | test_unhealthy_python_goes_missing | assert | bool_literal | 33 | from __future__ import annotations
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.envcontext import envcontext
from pre_commit.languages import python
from pre_commit.prefix import Prefix
from pre_commit.util import make_executable
from pre_commit.u... | False | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/autoupdate_test.py | test_autoupdate_up_to_date_repo | assert | numeric_literal | 67 | from __future__ import annotations
import shlex
from unittest import mock
import pytest
import yaml
import pre_commit.constants as C
from pre_commit import envcontext
from pre_commit import git
from pre_commit import util
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
from pre_commit.comm... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/autoupdate_test.py | test_autoupdate_latest_no_config | assert | numeric_literal | 65 | from __future__ import annotations
import shlex
from unittest import mock
import pytest
import yaml
import pre_commit.constants as C
from pre_commit import envcontext
from pre_commit import git
from pre_commit import util
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
from pre_commit.comm... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/autoupdate_test.py | test_autoupdate_local_hooks_with_out_of_date_repo | assert | numeric_literal | 67 | from __future__ import annotations
import shlex
from unittest import mock
import pytest
import yaml
import pre_commit.constants as C
from pre_commit import envcontext
from pre_commit import git
from pre_commit import util
from pre_commit.commands.autoupdate import _check_hooks_still_exist_at_rev
from pre_commit.comm... | 2 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/gc_test.py | _remove_config_assert_cleared | assert | numeric_literal | 30 | from __future__ import annotations
import os
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import load_config
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.commands.gc import gc
from pre_commit.commands.install_uninstall import install_hooks
from pre_com... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/gc_test.py | test_gc | assert | numeric_literal | 46 | from __future__ import annotations
import os
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import load_config
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.commands.gc import gc
from pre_commit.commands.install_uninstall import install_hooks
from pre_com... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/gc_test.py | test_gc | assert | numeric_literal | 47 | from __future__ import annotations
import os
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import load_config
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.commands.gc import gc
from pre_commit.commands.install_uninstall import install_hooks
from pre_com... | 2 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/hook_impl_test.py | test_validate_config_missing | assert | numeric_literal | 26 | from __future__ import annotations
import subprocess
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands import hook_impl
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from pre_commit.util import... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/hook_impl_test.py | test_validate_config_skip_via_env_variable | assert | numeric_literal | 27 | from __future__ import annotations
import subprocess
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands import hook_impl
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from pre_commit.util import... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/init_templatedir_test.py | test_init_templatedir | assert | numeric_literal | 39 | from __future__ import annotations
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.commands.init_templatedir import init_templatedir
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from testing.fixtures import git_dir
from te... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/init_templatedir_test.py | test_init_templatedir_already_set | assert | numeric_literal | 29 | from __future__ import annotations
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.commands.init_templatedir import init_templatedir
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from testing.fixtures import git_dir
from te... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/init_templatedir_test.py | test_init_templatedir_not_set | assert | numeric_literal | 29 | from __future__ import annotations
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.commands.init_templatedir import init_templatedir
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from testing.fixtures import git_dir
from te... | 3 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/install_uninstall_test.py | test_uninstall_does_not_blow_up_when_not_there | assert | numeric_literal | 31 | from __future__ import annotations
import os.path
import re
import re_assert
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands.install_uninstall import CURRENT_HASH
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.install_uninstall import install_h... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/install_uninstall_test.py | test_commit_msg_integration_failing | assert | numeric_literal | 74 | from __future__ import annotations
import os.path
import re
import re_assert
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands.install_uninstall import CURRENT_HASH
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.install_uninstall import install_h... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/run_test.py | test_global_exclude | assert | numeric_literal | 93 | from __future__ import annotations
import os.path
import shlex
import sys
import time
from typing import MutableMapping
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import color
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.run import _... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/run_test.py | test_from_ref_to_ref_error_msg_error | assert | numeric_literal | 90 | from __future__ import annotations
import os.path
import shlex
import sys
import time
from typing import MutableMapping
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import color
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.run import _... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/run_test.py | test_multiple_hooks_same_id | assert | numeric_literal | 91 | from __future__ import annotations
import os.path
import shlex
import sys
import time
from typing import MutableMapping
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import color
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.run import _... | 2 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/sample_config_test.py | test_sample_config | assert | numeric_literal | 8 | from __future__ import annotations
from pre_commit.commands.sample_config import sample_config
def test_sample_config(capsys):
ret = sample_config()
assert ret == | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/error_handler_test.py | test_error_handler_no_exception | assert | numeric_literal | 26 | from __future__ import annotations
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cm... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/error_handler_test.py | test_log_and_exit | assert | numeric_literal | 32 | from __future__ import annotations
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cm... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/helpers_test.py | test_target_concurrency_cpu_count_require_serial_true | assert | numeric_literal | 32 | from __future__ import annotations
import multiprocessing
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessErro... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/helpers_test.py | test_target_concurrency_on_travis | assert | numeric_literal | 32 | from __future__ import annotations
import multiprocessing
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import parse_shebang
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessErro... | 2 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/pygrep_test.py | test_negate_by_line_no_match | assert | numeric_literal | 22 | from __future__ import annotations
import pytest
from pre_commit.languages import pygrep
def some_files(tmpdir):
tmpdir.join('f1').write_binary(b'foo\nbar\n')
tmpdir.join('f2').write_binary(b'[INFO] hi\n')
tmpdir.join('f3').write_binary(b"with'quotes\n")
tmpdir.join('f4').write_binary(b'foo\npattern\... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/pygrep_test.py | test_negate_by_line_all_match | assert | numeric_literal | 22 | from __future__ import annotations
import pytest
from pre_commit.languages import pygrep
def some_files(tmpdir):
tmpdir.join('f1').write_binary(b'foo\nbar\n')
tmpdir.join('f2').write_binary(b'[INFO] hi\n')
tmpdir.join('f3').write_binary(b"with'quotes\n")
tmpdir.join('f4').write_binary(b'foo\npattern\... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/main_test.py | assert_only_one_mock_called | assert | numeric_literal | 46 | from __future__ import annotations
import argparse
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import main
from pre_commit.errors import FatalError
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.util ... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/meta_hooks/check_hooks_apply_test.py | test_hook_excludes_everything | assert | numeric_literal | 24 | from __future__ import annotations
from pre_commit.meta_hooks import check_hooks_apply
from testing.fixtures import add_config_to_repo
def test_hook_excludes_everything(capsys, in_git_dir, mock_store_dir):
config = {
'repos': [
{
'repo': 'meta',
'hooks': [
... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/meta_hooks/check_hooks_apply_test.py | test_valid_exceptions | assert | numeric_literal | 45 | from __future__ import annotations
from pre_commit.meta_hooks import check_hooks_apply
from testing.fixtures import add_config_to_repo
def test_valid_exceptions(capsys, in_git_dir, mock_store_dir):
config = {
'repos': [
{
'repo': 'local',
'hooks': [
... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/meta_hooks/check_useless_excludes_test.py | test_useless_exclude_global | assert | numeric_literal | 25 | from __future__ import annotations
from pre_commit import git
from pre_commit.meta_hooks import check_useless_excludes
from pre_commit.util import cmd_output
from testing.fixtures import add_config_to_repo
from testing.fixtures import make_config_from_repo
from testing.fixtures import make_repo
from testing.util impor... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/meta_hooks/check_useless_excludes_test.py | test_no_excludes | assert | numeric_literal | 24 | from __future__ import annotations
from pre_commit import git
from pre_commit.meta_hooks import check_useless_excludes
from pre_commit.util import cmd_output
from testing.fixtures import add_config_to_repo
from testing.fixtures import make_config_from_repo
from testing.fixtures import make_repo
from testing.util impor... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/repository_test.py | test_local_conda_additional_dependencies | assert | numeric_literal | 94 | from __future__ import annotations
import os.path
import shutil
import sys
from typing import Any
from unittest import mock
import cfgv
import pytest
import re_assert
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import load_manif... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/repository_test.py | test_grep_hook_matching | assert | numeric_literal | 105 | from __future__ import annotations
import os.path
import shutil
import sys
from typing import Any
from unittest import mock
import cfgv
import pytest
import re_assert
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import load_manif... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/repository_test.py | test_reinstall | assert | numeric_literal | 114 | from __future__ import annotations
import os.path
import shutil
import sys
from typing import Any
from unittest import mock
import cfgv
import pytest
import re_assert
import pre_commit.constants as C
from pre_commit import git
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import load_manif... | 4 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/util_test.py | test_cmd_output_exe_not_found | assert | numeric_literal | 22 | from __future__ import annotations
import os.path
import stat
import subprocess
import pytest
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b
from pre_commit.util import cmd_output_p
from ... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/xargs_test.py | test_xargs_smoke | assert | numeric_literal | 27 | from __future__ import annotations
import concurrent.futures
import os
import sys
import time
from unittest import mock
import pytest
from pre_commit import parse_shebang
from pre_commit import xargs
def win32_mock():
with mock.patch.object(sys, 'getfilesystemencoding', return_value='utf-8'):
with mock.... | 0 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/xargs_test.py | test_xargs_retcode_normal | assert | numeric_literal | 30 | from __future__ import annotations
import concurrent.futures
import os
import sys
import time
from unittest import mock
import pytest
from pre_commit import parse_shebang
from pre_commit import xargs
def win32_mock():
with mock.patch.object(sys, 'getfilesystemencoding', return_value='utf-8'):
with mock.... | 1 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/xargs_test.py | test_xargs_retcode_normal | assert | numeric_literal | 34 | from __future__ import annotations
import concurrent.futures
import os
import sys
import time
from unittest import mock
import pytest
from pre_commit import parse_shebang
from pre_commit import xargs
def win32_mock():
with mock.patch.object(sys, 'getfilesystemencoding', return_value='utf-8'):
with mock.... | 5 | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/commands/hook_impl_test.py | test_run_ns_pre_commit | assert | none_literal | 24 | from __future__ import annotations
import subprocess
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import git
from pre_commit.commands import hook_impl
from pre_commit.envcontext import envcontext
from pre_commit.util import cmd_output
from pre_commit.util import... | None | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/languages/python_test.py | test_norm_version_of_default_is_sys_executable | assert | none_literal | 18 | from __future__ import annotations
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.envcontext import envcontext
from pre_commit.languages import python
from pre_commit.prefix import Prefix
from pre_commit.util import make_executable
from pre_commit.u... | None | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/main_test.py | test_adjust_args_try_repo_repo_relative | assert | none_literal | 26 | from __future__ import annotations
import argparse
import os.path
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit import main
from pre_commit.errors import FatalError
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.util ... | None | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
pre-commit/pre-commit | a5225070208dbdf266fb793f3faac45f4462948c | 502 | train | train | tests/parse_shebang_test.py | _echo_exe | assert | none_literal | 18 | from __future__ import annotations
import contextlib
import os.path
import shutil
import sys
import pytest
from pre_commit import parse_shebang
from pre_commit.envcontext import envcontext
from pre_commit.envcontext import Var
from pre_commit.util import make_executable
def _echo_exe() -> str:
exe = shutil.whic... | None | a5225070208dbdf266fb793f3faac45f4462948c | 502 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_list_repo | assert | numeric_literal | 16 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_list_repo(mock_client):
github = GitHubService(base_url=BASE_URL, client=mock_client)
github.list_repos("prkumar")
request = mock_client.history[0]
assert request.method == "GET"
assert request.has_base_url(BASE_URL)
as... | 15 | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_list_repo | assert | string_literal | 12 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_list_repo(mock_client):
github = GitHubService(base_url=BASE_URL, client=mock_client)
github.list_repos("prkumar")
request = mock_client.history[0]
assert request.method == | "GET" | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_get_repo | assert | variable | 23 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_get_repo(mock_client, mock_response):
"""
This integration test ensures that the returns.json returns the
Json body when a model is not provided.
"""
# Setup: return a mock response
expected_json = {"key": "value"}
... | actual_json | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_handle_client_exceptions | pytest.raises | complex_expr | 32 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_handle_client_exceptions(mock_client):
# Setup: mock client exceptions
class MockBaseClientException(Exception):
pass
class MockInvalidURL(MockBaseClientException):
pass
mock_client.exceptions.BaseClientExcep... | service.exceptions.InvalidURL) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_list_repo_wrapper | assert | complex_expr | 11 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_list_repo_wrapper(mock_client):
"""Ensures that the consumer method looks like the original func."""
github = GitHubService(base_url=BASE_URL, client=mock_client)
assert | GitHubService.list_repos.__doc__ | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_list_repo_wrapper | assert | complex_expr | 16 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_list_repo_wrapper(mock_client):
"""Ensures that the consumer method looks like the original func."""
github = GitHubService(base_url=BASE_URL, client=mock_client)
assert (
github.list_repos.__doc__
== GitHubService.... | GitHubService.list_repos.__name__ | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_handle_client_exceptions | pytest.raises | complex_expr | 26 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_handle_client_exceptions(mock_client):
# Setup: mock client exceptions
class MockBaseClientException(Exception):
pass
class MockInvalidURL(MockBaseClientException):
pass
mock_client.exceptions.BaseClientExcep... | service.exceptions.BaseClientException) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_basic.py | test_list_repo | assert | collection | 15 | import pytest
import uplink
BASE_URL = "https://api.github.com/"
def test_list_repo(mock_client):
github = GitHubService(base_url=BASE_URL, client=mock_client)
github.list_repos("prkumar")
request = mock_client.history[0]
assert request.method == "GET"
assert request.has_base_url(BASE_URL)
as... | {"Accept": "application/vnd.github.v3.full+json"} | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository | assert | numeric_literal | 31 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", name: "upli... | 10 | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository | assert | variable | 32 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", name: "upli... | data | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository | assert | string_literal | 28 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", name: "upli... | "POST" | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository | assert | variable | 29 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", name: "upli... | BASE_URL | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository | assert | string_literal | 30 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", name: "upli... | "/graphql" | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository2_failure | assert | string_literal | 41 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository2_failure(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", na... | "/graphql2" | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_extend.py | test_get_repository2_failure | pytest.raises | variable | 36 | import pytest
import uplink
BASE_URL = "https://api.github.com"
def github_error(response):
if "errors" in response.json():
raise GitHubError()
return response
def test_get_repository2_failure(mock_client, mock_response):
data = {
"query": """\
query {
repository(owner: "prkumar", na... | GitHubError) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_form_url_encoded.py | test_without_converter | assert | collection | 21 | from uplink import Consumer, form_url_encoded, put, FieldMap
BASE_URL = "https://example.com/"
def test_without_converter(mock_response, mock_client):
class Calendar(Consumer):
@form_url_encoded
@put("/user/repos", args={"event_data": FieldMap})
def add_event(self, **event_data):
... | {"name": "Weekly Stand-up", "public": True} | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_handlers.py | test_response_handler_with_consumer | assert | bool_literal | 29 | import uplink
BASE_URL = "https://example.com/"
def handle_response_with_consumer(consumer, response):
consumer.flagged = True
return response
def handle_response(response):
response.flagged = True
return response
def handle_error_with_consumer(consumer, exc_type, exc_value, exc_tb):
consumer.fl... | True | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_handlers.py | test_error_handler_with_consumer | assert | variable | 33 | import uplink
BASE_URL = "https://example.com/"
def handle_response_with_consumer(consumer, response):
consumer.flagged = True
return response
def handle_response(response):
response.flagged = True
return response
def handle_error_with_consumer(consumer, exc_type, exc_value, exc_tb):
consumer.fl... | expected_error | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_multipart.py | test_without_converter | assert | collection | 22 | from uplink import Consumer, PartMap, post, multipart
BASE_URL = "https://example.com/"
def test_without_converter(mock_response, mock_client):
class Calendar(Consumer):
@multipart
@post("/attachments", args={"files": PartMap})
def upload_attachments(self, **files):
pass
m... | {"file": file} | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_ratelimit.py | test_exceeded_limit_wait | assert | numeric_literal | 20 | import pytest
import uplink
from uplink.ratelimit import RateLimitExceeded, now
BASE_URL = "https://api.github.com/"
DIFFERENT_BASE_URL = "https://hostedgithub.com/"
def test_exceeded_limit_wait(mock_client):
# Setup
github = GitHub(base_url=BASE_URL, client=mock_client)
# Run
start = now()
gith... | 1 | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_ratelimit.py | test_limit_exceeded_by_1 | pytest.raises | variable | 17 | import pytest
import uplink
from uplink.ratelimit import RateLimitExceeded, now
BASE_URL = "https://api.github.com/"
DIFFERENT_BASE_URL = "https://hostedgithub.com/"
def test_limit_exceeded_by_1(mock_client):
# Setup
github = GitHub(base_url=BASE_URL, client=mock_client)
# Run
github.get_user("prkum... | RateLimitExceeded) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_ratelimit.py | test_limit_exceeded_by_1_with_custom_exception | pytest.raises | variable | 17 | import pytest
import uplink
from uplink.ratelimit import RateLimitExceeded, now
BASE_URL = "https://api.github.com/"
DIFFERENT_BASE_URL = "https://hostedgithub.com/"
def test_limit_exceeded_by_1_with_custom_exception(mock_client):
# Setup
github = GitHub(base_url=BASE_URL, client=mock_client)
# Run
... | CustomRateLimitException) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_retry.py | test_retry | assert | numeric_literal | 24 | import pytest
import pytest_twisted
from uplink import get, Consumer, retry
from uplink.clients import io
from tests import requires_python34
BASE_URL = "https://api.github.com/"
def backoff_once():
yield 0.1
def test_retry(mock_client, mock_response):
# Setup
mock_response.with_json({"id": 123, "name":... | 2 | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_retry.py | test_retry_fail | pytest.raises | variable | 21 | import pytest
import pytest_twisted
from uplink import get, Consumer, retry
from uplink.clients import io
from tests import requires_python34
BASE_URL = "https://api.github.com/"
def backoff_once():
yield 0.1
def test_retry_fail(mock_client, mock_response):
# Setup
mock_response.with_json({"id": 123, "n... | Exception) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_retry.py | test_retry_fail_with_client_exception | pytest.raises | variable | 31 | import pytest
import pytest_twisted
from uplink import get, Consumer, retry
from uplink.clients import io
from tests import requires_python34
BASE_URL = "https://api.github.com/"
def backoff_once():
yield 0.1
def test_retry_fail_with_client_exception(mock_client, mock_response):
# Setup
mock_response.wi... | CustomException) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_retry.py | test_retry | assert | collection | 25 | import pytest
import pytest_twisted
from uplink import get, Consumer, retry
from uplink.clients import io
from tests import requires_python34
BASE_URL = "https://api.github.com/"
def backoff_once():
yield 0.1
def test_retry(mock_client, mock_response):
# Setup
mock_response.with_json({"id": 123, "name":... | {"id": 123, "name": "prkumar"} | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_returns.py | test_returns_json_by_key | assert | numeric_literal | 38 | import collections
import uplink
BASE_URL = "https://api.github.com/"
User = collections.namedtuple("User", "id name")
Repo = collections.namedtuple("Repo", "owner name")
def user_reader(cls, response):
return cls(**response.json())
def repo_json_reader(cls, json):
return cls(**json)
def repo_json_writer(... | 300 | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_returns.py | test_returns_with_type | assert | variable | 32 | import collections
import uplink
BASE_URL = "https://api.github.com/"
User = collections.namedtuple("User", "id name")
Repo = collections.namedtuple("Repo", "owner name")
def user_reader(cls, response):
return cls(**response.json())
def repo_json_reader(cls, json):
return cls(**json)
def repo_json_writer(... | user | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_returns.py | test_returns_json_with_type | assert | variable | 32 | import collections
import uplink
BASE_URL = "https://api.github.com/"
User = collections.namedtuple("User", "id name")
Repo = collections.namedtuple("Repo", "owner name")
def user_reader(cls, response):
return cls(**response.json())
def repo_json_reader(cls, json):
return cls(**json)
def repo_json_writer(... | repo | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_returns.py | test_returns_response_when_type_has_no_converter | assert | variable | 34 | import collections
import uplink
BASE_URL = "https://api.github.com/"
User = collections.namedtuple("User", "id name")
Repo = collections.namedtuple("Repo", "owner name")
def user_reader(cls, response):
return cls(**response.json())
def repo_json_reader(cls, json):
return cls(**json)
def repo_json_writer(... | mock_response | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/integration/test_returns.py | test_post_json | assert | collection | 27 | import collections
import uplink
BASE_URL = "https://api.github.com/"
User = collections.namedtuple("User", "id name")
Repo = collections.namedtuple("Repo", "owner name")
def user_reader(cls, response):
return cls(**response.json())
def repo_json_reader(cls, json):
return cls(**json)
def repo_json_writer(... | {"owner": "prkumar", "name": "uplink"} | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/unit/test__extras.py | test_install | assert_* | variable | 16 | import pytest
from uplink import _extras
def test_install(mocker):
# Setup
func = mocker.stub()
installers = {list: func}
obj = []
# Run: Success
_extras.install(obj, _installers=installers)
# Verify
func.assert_called_with( | obj) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/unit/test__extras.py | test_install | pytest.raises | variable | 19 | import pytest
from uplink import _extras
def test_install(mocker):
# Setup
func = mocker.stub()
installers = {list: func}
obj = []
# Run: Success
_extras.install(obj, _installers=installers)
# Verify
func.assert_called_with(obj)
# Run & Verify Failure
with pytest.raises( | TypeError) | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | train | train | tests/unit/test__extras.py | test_load_entry_points | assert_* | string_literal | 22 | import pytest
from uplink import _extras
def test_load_entry_points(mocker):
# Setup
func = mocker.stub()
iter_entry_points = mocker.stub()
entry_point = mocker.Mock()
entry_point.name = "plugin-name"
entry_point.load.return_value = "plugin-value"
iter_entry_points.return_value = [entry_po... | "plugin-value") | 3472806f68a60a93f7cb555d36365551a5411cc5 | 30 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.