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
pre-commit/pre-commit
from __future__ import annotations import io from pre_commit import output def test_output_write_writes(): stream = io.BytesIO() output.write('hello world', stream) assert stream.getvalue() ==
b'hello world'
assert
string_literal
tests/output_test.py
test_output_write_writes
11
null
pre-commit/pre-commit
from __future__ import annotations import argparse import contextlib import os.path from unittest import mock import pytest import pre_commit.constants as C from pre_commit import main from pre_commit.commands import hazmat from pre_commit.errors import FatalError from pre_commit.util import cmd_output from testing....
{}
assert
collection
tests/main_test.py
test_hazmat
166
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import re_assert import pre_commit.constants as C from pre_commit import lang_base from pre_commit.commands.install_uninstall import install from pre_commit.envcontext import envcontext from pre_commit.languages import golang from pre_commit....
(0, b'hello world\n')
assert
collection
tests/languages/golang_test.py
test_golang_system
100
null
pre-commit/pre-commit
from __future__ import annotations import contextlib import itertools import os.path import shutil import pytest import re_assert from pre_commit import git from pre_commit.errors import FatalError from pre_commit.staged_files_only import staged_files_only from pre_commit.util import cmd_output from testing.auto_nam...
'new contents'
assert
string_literal
tests/staged_files_only_test.py
test_failed_diff_does_not_discard_changes
449
null
pre-commit/pre-commit
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 resolve_conflict(): with open('conflict_file', 'w') as conflicted_file: conflicted_fil...
['b.txt']
assert
collection
tests/git_test.py
test_get_changed_files_disparate_histories
198
null
pre-commit/pre-commit
from __future__ import annotations from pre_commit.languages import unsupported from testing.language_helpers import run_language def test_unsupported_language(tmp_path): expected = (0, b'hello hello world\n') ret = run_language(tmp_path, unsupported, 'echo hello hello world') assert ret ==
expected
assert
variable
tests/languages/unsupported_test.py
test_unsupported_language
10
null
pre-commit/pre-commit
from __future__ import annotations import sys import pytest from pre_commit.commands.hazmat import _cmd_filenames from pre_commit.commands.hazmat import main from testing.util import cwd def _norm(out): return out.replace('\r\n', '\n') def test_n1_some_error_code(): ret = main(( 'n1', sys.executabl...
1
assert
numeric_literal
tests/commands/hazmat_test.py
test_n1_some_error_code
99
null
pre-commit/pre-commit
from __future__ import annotations import os from unittest import mock import pytest from pre_commit.envcontext import envcontext from pre_commit.envcontext import UNSET from pre_commit.envcontext import Var def _test(*, before, patch, expected): env = before.copy() with envcontext(patch, _env=env): ...
MyError)
pytest.raises
variable
tests/envcontext_test.py
test_exception_safety
92
null
pre-commit/pre-commit
from __future__ import annotations import contextlib import itertools import os.path import shutil import pytest import re_assert from pre_commit import git from pre_commit.errors import FatalError from pre_commit.staged_files_only import staged_files_only from pre_commit.util import cmd_output from testing.auto_nam...
['foo']
assert
collection
tests/staged_files_only_test.py
test_intent_to_add
400
null
pre-commit/pre-commit
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...
''
assert
string_literal
tests/commands/hook_impl_test.py
test_hook_impl_main_noop_pre_push
362
null
pre-commit/pre-commit
from __future__ import annotations import pytest from pre_commit.languages import docker_image from pre_commit.util import cmd_output_b from testing.language_helpers import run_language from testing.util import xfailif_windows def _ensure_image_available(): cmd_output_b('docker', 'run', '--rm', 'ubuntu:22.04', '...
(0, b'root:x:0:\n')
assert
collection
tests/languages/docker_image_test.py
test_docker_image_no_color_no_tty
59
null
pre-commit/pre-commit
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
assert
numeric_literal
tests/commands/hook_impl_test.py
test_validate_config_missing
31
null
pre-commit/pre-commit
from __future__ import annotations import os.path import sys from unittest import mock import pytest import pre_commit.constants as C from pre_commit import lang_base from pre_commit import parse_shebang from pre_commit import xargs from pre_commit.prefix import Prefix from pre_commit.util import CalledProcessError ...
expected
assert
variable
tests/lang_base_test.py
test_shuffled_is_deterministic
141
null
pre-commit/pre-commit
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...
src
assert
variable
tests/commands/hook_impl_test.py
test_run_ns_pre_push_updating_branch
276
null
pre-commit/pre-commit
from __future__ import annotations import pytest from pre_commit.yaml import yaml_compose from pre_commit.yaml_rewrite import MappingKey from pre_commit.yaml_rewrite import MappingValue from pre_commit.yaml_rewrite import match from pre_commit.yaml_rewrite import SequenceItem def test_mapping_value(): m = Mappin...
['val']
assert
collection
tests/yaml_rewrite_test.py
test_mapping_value
42
null
pre-commit/pre-commit
from __future__ import annotations import argparse import contextlib import os.path from unittest import mock import pytest import pre_commit.constants as C from pre_commit import main from pre_commit.commands import hazmat from pre_commit.errors import FatalError from pre_commit.util import cmd_output from testing....
in_git_dir
assert
variable
tests/main_test.py
test_adjust_args_and_chdir_noop
35
null
pre-commit/pre-commit
from __future__ import annotations import os from collections.abc import Sequence from pre_commit.lang_base import Language from pre_commit.prefix import Prefix def run_language( path: os.PathLike[str], language: Language, exe: str, args: Sequence[str] = (), file_args: Sequenc...
None
assert
none_literal
testing/language_helpers.py
run_language
28
null
pre-commit/pre-commit
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...
(us, path)
assert
collection
tests/parse_shebang_test.py
test_normalize_cmd_shebang
138
null
pre-commit/pre-commit
from __future__ import annotations import os.path import shlex import shutil import sys from typing import Any from unittest import mock import cfgv import pytest import pre_commit.constants as C from pre_commit import lang_base from pre_commit.all_languages import languages from pre_commit.clientlib import CONFIG_S...
True
assert
bool_literal
tests/repository_test.py
test_repository_state_compatibility
198
null
pre-commit/pre-commit
from __future__ import annotations import contextlib import itertools import os.path import shutil import pytest import re_assert from pre_commit import git from pre_commit.errors import FatalError from pre_commit.staged_files_only import staged_files_only from pre_commit.util import cmd_output from testing.auto_nam...
status
assert
variable
tests/staged_files_only_test.py
_test_sub_state
231
null
pre-commit/pre-commit
from __future__ import annotations import os.path import shlex import shutil import sys from typing import Any from unittest import mock import cfgv import pytest import pre_commit.constants as C from pre_commit import lang_base from pre_commit.all_languages import languages from pre_commit.clientlib import CONFIG_S...
'fake2'
assert
string_literal
tests/repository_test.py
test_default_language_version
375
null
pre-commit/pre-commit
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
assert
bool_literal
tests/git_test.py
test_is_in_merge_conflict
97
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import pre_commit.constants as C from pre_commit import parse_shebang from pre_commit.languages import rust from pre_commit.store import _make_local_repo from testing.language_helpers import run_language from testing.util import cwd ACTUAL_G...
(0, b'echo "$hi"\n')
assert
collection
tests/languages/rust_test.py
test_rust_cli_additional_dependencies
102
null
pre-commit/pre-commit
from __future__ import annotations import logging import os.path import shlex import sqlite3 import stat from unittest import mock import pytest import pre_commit.constants as C from pre_commit import git from pre_commit.store import _get_default_directory from pre_commit.store import _LOCAL_RESOURCES from pre_commi...
[(path, rev, ret)]
assert
collection
tests/store_test.py
test_clone
105
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import re_assert import pre_commit.constants as C from pre_commit import lang_base from pre_commit.commands.install_uninstall import install from pre_commit.envcontext import envcontext from pre_commit.languages import golang from pre_commit....
'1.19.4'
assert
string_literal
tests/languages/golang_test.py
test_golang_infer_go_version_not_default
47
null
pre-commit/pre-commit
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_get_staged_files_deleted(in_git_dir): in_git_dir.join('test').ensure() cmd_output('gi...
[]
assert
collection
tests/git_test.py
test_get_staged_files_deleted
89
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import re_assert import pre_commit.constants as C from pre_commit import lang_base from pre_commit.commands.install_uninstall import install from pre_commit.envcontext import envcontext from pre_commit.languages import golang from pre_commit....
version)
assert_*
variable
tests/languages/golang_test.py
test_golang_infer_go_version_default
54
null
pre-commit/pre-commit
from __future__ import annotations import os.path import sys from unittest import mock import pytest import pre_commit.constants as C from pre_commit import lang_base from pre_commit import parse_shebang from pre_commit import xargs from pre_commit.prefix import Prefix from pre_commit.util import CalledProcessError ...
None
assert
none_literal
tests/lang_base_test.py
test_basic_health_check
70
null
pre-commit/pre-commit
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
assert
numeric_literal
tests/util_test.py
test_cmd_output_exe_not_found
77
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import re_assert import pre_commit.constants as C from pre_commit import lang_base from pre_commit.commands.install_uninstall import install from pre_commit.envcontext import envcontext from pre_commit.languages import golang from pre_commit....
out.decode()
assert
func_call
tests/languages/golang_test.py
test_automatic_toolchain_switching_go_fmt
236
null
pre-commit/pre-commit
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
assert
numeric_literal
tests/commands/init_templatedir_test.py
test_init_templatedir_already_set
53
null
pre-commit/pre-commit
from __future__ import annotations import tarfile from unittest import mock import pytest import pre_commit.constants as C from pre_commit import parse_shebang from pre_commit.envcontext import envcontext from pre_commit.languages import ruby from pre_commit.languages.ruby import _resource_bytesio from pre_commit.st...
(0, b'')
assert
collection
tests/languages/ruby_test.py
test_ruby_additional_deps
97
null
pre-commit/pre-commit
from __future__ import annotations import logging import os.path import shlex import sqlite3 import stat from unittest import mock import pytest import pre_commit.constants as C from pre_commit import git from pre_commit.store import _get_default_directory from pre_commit.store import _LOCAL_RESOURCES from pre_commi...
'fake_path'
assert
string_literal
tests/store_test.py
test_clone_when_repo_already_exists
196
null
pre-commit/pre-commit
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 from testing.language_helpers import run_language from testing.util import xfaili...
'abc'
assert
string_literal
tests/languages/docker_test.py
test_get_docker_path_not_in_docker_returns_same
267
null
pre-commit/pre-commit
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
assert
numeric_literal
tests/commands/init_templatedir_test.py
test_init_templatedir
39
null
pre-commit/pre-commit
from __future__ import annotations import os.path from unittest import mock import pytest from pre_commit.commands.clean import clean def _expanduser(path, *args, **kwargs): assert path ==
'~/.pre-commit'
assert
string_literal
tests/commands/clean_test.py
_expanduser
16
null
pre-commit/pre-commit
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
assert
none_literal
tests/parse_shebang_test.py
_echo_exe
18
null
pre-commit/pre-commit
from __future__ import annotations import concurrent.futures import multiprocessing import os import sys import time from unittest import mock import pytest from pre_commit import parse_shebang from pre_commit import xargs def no_sched_getaffinity(): # Simulates an OS without os.sched_getaffinity available (mac...
map
assert
variable
tests/xargs_test.py
test_thread_mapper_concurrency_uses_regular_map
221
null
pre-commit/pre-commit
from __future__ import annotations import logging import os.path import shlex import sqlite3 import stat from unittest import mock import pytest import pre_commit.constants as C from pre_commit import git from pre_commit.store import _get_default_directory from pre_commit.store import _LOCAL_RESOURCES from pre_commi...
expected
assert
variable
tests/store_test.py
test_get_default_directory_defaults_to_home
48
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import yaml import pre_commit.constants as C from pre_commit.clientlib import InvalidConfigError from pre_commit.commands.migrate_config import migrate_config from pre_commit.yaml import yaml_compose def switch_pyyaml_impl(request): if r...
expected
assert
variable
tests/commands/migrate_config_test.py
test_migrate_config_sha_to_rev_json
171
null
pre-commit/pre-commit
from __future__ import annotations import os.path import shlex import shutil import sys from typing import Any from unittest import mock import cfgv import pytest import pre_commit.constants as C from pre_commit import lang_base from pre_commit.all_languages import languages from pre_commit.clientlib import CONFIG_S...
1
assert
numeric_literal
tests/repository_test.py
test_non_installable_hook_error_for_language_version
467
null
pre-commit/pre-commit
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 from testing.language_helpers import run_language from testing.util import xfaili...
path
assert
variable
tests/languages/docker_test.py
test_get_docker_path_in_docker_no_substring
321
null
pre-commit/pre-commit
from __future__ import annotations import pytest from pre_commit.languages import pygrep from testing.language_helpers import run_language 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") ...
''
assert
string_literal
tests/languages/pygrep_test.py
test_negate_by_line_all_match
63
null
pre-commit/pre-commit
from __future__ import annotations import pytest from pre_commit.yaml import yaml_compose from pre_commit.yaml_rewrite import MappingKey from pre_commit.yaml_rewrite import MappingValue from pre_commit.yaml_rewrite import match from pre_commit.yaml_rewrite import SequenceItem def test_match_produces_scalar_values_on...
['foo', 'bar']
assert
collection
tests/yaml_rewrite_test.py
test_match_produces_scalar_values_only
20
null
pre-commit/pre-commit
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 @pytest.mark.parametrize( ('in_text', 'in_color', 'in_use_color', 'expected'...
expected
assert
variable
tests/color_test.py
test_format_color
22
null
pre-commit/pre-commit
from __future__ import annotations from unittest import mock import pytest import re_assert import pre_commit.constants as C from pre_commit import lang_base from pre_commit.commands.install_uninstall import install from pre_commit.envcontext import envcontext from pre_commit.languages import golang from pre_commit....
'system'
assert
string_literal
tests/languages/golang_test.py
test_golang_default_version_system_available
35
null
pfnet/pysen
import collections import pathlib from typing import DefaultDict, Iterator from unittest import mock import pytest from pysen import mypy from pysen.mypy import _get_differences_from_base from pysen.process_utils import add_python_executable from pysen.reporter import Reporter from pysen.runner_options import PathCon...
{"B": "b", "C": "c", "Y": ["a", "b"]}
assert
collection
tests/test_mypy.py
test__get_differences_from_base
29
null
pfnet/pysen
import pytest from pysen.py_version import PythonVersion, VersionRepresentation def check_version(s: str, expected: VersionRepresentation) -> None: actual = VersionRepresentation.from_str(s) assert actual == expected assert s ==
str(expected)
assert
func_call
tests/test_py_version.py
check_version
72
null
pfnet/pysen
import pytest import tomlkit from pysen.pyproject_model import _get_descendant from pysen.setting import _create_dict, _traverse_toml def test__create_dict() -> None: assert _create_dict([]) == {} assert _create_dict(["foo"]) ==
{"foo": {}}
assert
collection
tests/test_setting.py
test__create_dict
10
null
pfnet/pysen
import argparse import pathlib from typing import Any, Callable, Dict, List, Optional, Sequence import pytest from fakes.component import FakeComponent, Operation from pysen import dumper from pysen.component import ComponentBase from pysen.exceptions import InvalidComponentName from pysen.manifest import Manifest, e...
InvalidComponentName)
pytest.raises
variable
tests/test_manifest.py
test_get_targets
118
null
pfnet/pysen
import math import pathlib import threading import unittest.mock from typing import Any, Callable, List, Optional, cast import pytest from _pytest.capture import CaptureFixture from fakes.component import FakeCommand, FakeComponent, Operation from fakes.manifest import FakeManifest from pysen.command import CommandBa...
0
assert
numeric_literal
tests/test_runner.py
test_parse_manifest_arguments
134
null
pfnet/pysen
import argparse import pathlib from typing import Dict, List, Mapping, Optional, Sequence from pysen.command import CommandBase from pysen.manifest import ( ComponentName, ManifestBase, ParserType, TargetName, TargetType, ) from pysen.runner_options import PathContext, RunOptions class FakeManifes...
self._expected_base_dir
assert
complex_expr
tests/fakes/manifest.py
export_settings
FakeManifest
51
null
pfnet/pysen
import argparse import pathlib from typing import Any, Callable, Dict, List, Optional, Sequence import pytest from fakes.component import FakeComponent, Operation from pysen import dumper from pysen.component import ComponentBase from pysen.exceptions import InvalidComponentName from pysen.manifest import Manifest, e...
2
assert
numeric_literal
tests/test_manifest.py
test_get_target
139
null
pfnet/pysen
from importlib.metadata import PackageNotFoundError from pathlib import Path from unittest import mock import pytest from pysen.exceptions import ( DistributionNotFound, IncompatibleVersionError, UnexpectedErrorFormat, ) from pysen.ext.isort_wrapper import ( IsortSectionName, IsortSetting, _ch...
["tool", "isort"]
assert
collection
tests/test_isort.py
test_export
32
null
pfnet/pysen
import pathlib from pysen.cli_config import parse BASE_DIR = pathlib.Path(__file__).resolve().parent CONFIG_DIR = BASE_DIR / "fakes/configs" def test_example() -> None: config = parse(CONFIG_DIR / "example.toml") assert config is not None assert config.settings_dir is not None assert config.settings...
CONFIG_DIR / "hoge"
assert
complex_expr
tests/test_cli_config.py
test_example
13
null
pfnet/pysen
import pathlib import tempfile from typing import List import pytest from pysen import ManifestBase from pysen.black import Black from pysen.component import ComponentBase from pysen.exceptions import InvalidManifestBuilderError from pysen.flake8 import Flake8 from pysen.manifest import Manifest from pysen.manifest_b...
{BASE_DIR}
assert
collection
tests/test_manifest_builder.py
test__build_external
31
null
pfnet/pysen
from importlib.metadata import PackageNotFoundError from pathlib import Path from unittest import mock import pytest from pysen.exceptions import ( DistributionNotFound, IncompatibleVersionError, UnexpectedErrorFormat, ) from pysen.ext.isort_wrapper import ( IsortSectionName, IsortSetting, _ch...
DistributionNotFound)
pytest.raises
variable
tests/test_isort.py
test__get_isort_version
116
null
pfnet/pysen
from pysen.black import Black from pysen.factory import ConfigureLintOptions, configure_lint from pysen.source import Source def test_configure_lint_default_source() -> None: components = configure_lint(ConfigureLintOptions(enable_black=True, source=None)) assert len(components) == 1 black = components[0] ...
{"."}
assert
collection
tests/test_factory.py
test_configure_lint_default_source
13
null
pfnet/pysen
import math import pathlib import threading import unittest.mock from typing import Any, Callable, List, Optional, cast import pytest from _pytest.capture import CaptureFixture from fakes.component import FakeCommand, FakeComponent, Operation from fakes.manifest import FakeManifest from pysen.command import CommandBa...
1
assert
numeric_literal
tests/test_runner.py
test_get_targets
107
null
pfnet/pysen
import pathlib import tempfile from typing import Sequence import git import pytest from _pytest.monkeypatch import MonkeyPatch from pysen import git_utils from pysen.git_utils import GitRepositoryNotFoundError BASE_DIR = pathlib.Path(__file__).resolve().parent def test_list_indexed_files() -> None: def list_in...
{test_file3}
assert
collection
tests/test_git_utils.py
test_list_indexed_files
91
null
pfnet/pysen
import io import logging import os import pathlib import sys import tempfile from typing import List import pytest from pysen.process_utils import _read_stream, run from pysen.reporter import Reporter SAMPLE_DATA = """BytesIO example string. Motivation-Driven Learn or Die Proud, but Humble Boldly do what no one has...
expected_ascii
assert
variable
tests/test_process_utils.py
test_run_encoding
119
null
pfnet/pysen
import pytest from pysen.py_version import PythonVersion, VersionRepresentation def test_python_version() -> None: py38 = PythonVersion(3, 8) assert py38 == PythonVersion(3, 8) assert py38 != PythonVersion(3, 9) assert py38.version == "3.8" assert py38.full_representation == "Python3.8" asse...
"3.8.8"
assert
string_literal
tests/test_py_version.py
test_python_version
22
null
pfnet/pysen
import pathlib from pysen.path import change_dir, get_relative_path, is_contained, is_covered BASE_DIR = pathlib.Path(__file__).resolve().parent def test_change_dir() -> None: current = pathlib.Path.cwd() with change_dir(BASE_DIR / "fakes"): assert pathlib.Path.cwd() ==
BASE_DIR / "fakes"
assert
complex_expr
tests/test_path.py
test_change_dir
34
null
pfnet/pysen
import collections import pathlib from typing import DefaultDict, Iterator from unittest import mock import pytest from pysen import mypy from pysen.mypy import _get_differences_from_base from pysen.process_utils import add_python_executable from pysen.reporter import Reporter from pysen.runner_options import PathCon...
{}
assert
collection
tests/test_mypy.py
test_settings
85
null
pfnet/pysen
import collections import pathlib from typing import DefaultDict, Iterator from unittest import mock import pytest from pysen import mypy from pysen.mypy import _get_differences_from_base from pysen.process_utils import add_python_executable from pysen.reporter import Reporter from pysen.runner_options import PathCon...
["mypy"]
assert
collection
tests/test_mypy.py
test_mypy_setting
39
null
pfnet/pysen
import enum import pathlib from typing import DefaultDict, Dict, List, Optional, Sequence, Tuple from pysen import ComponentBase from pysen.command import CommandBase from pysen.diagnostic import Diagnostic from pysen.reporter import Reporter from pysen.runner_options import PathContext, RunOptions from pysen.setting ...
1
assert
numeric_literal
tests/fakes/component.py
__init__
FakeCommand
26
null
pfnet/pysen
import pathlib from unittest import mock import pytest from pysen.diagnostic import Diagnostic, FLCMFormatter from pysen.reporter import Reporter, ReporterFactory BASE_DIR = pathlib.Path(__file__).resolve().parent def test_reporter() -> None: r = Reporter("fuga") with pytest.raises(
AssertionError)
pytest.raises
variable
tests/test_reporter.py
test_reporter
15
null
pfnet/pysen
import pathlib import re import tempfile from typing import Iterator import pytest import tomlkit from pysen import dumper from pysen.setting import SettingFile MULTIPLE_SPACES = re.compile(r"\s+") TOOL_HEADING = "[tool]\n" def normalize_spaces(s: str) -> str: return MULTIPLE_SPACES.sub(" ", s) def temp_file()...
expected.as_dict()
assert
func_call
tests/test_dumper.py
_assert_toml
70
null
pfnet/pysen
import collections import pathlib from typing import DefaultDict, Iterator from unittest import mock import pytest from pysen import mypy from pysen.mypy import _get_differences_from_base from pysen.process_utils import add_python_executable from pysen.reporter import Reporter from pysen.runner_options import PathCon...
{"C": "c2", "D": "d", "Y": ["a", "c"]}
assert
collection
tests/test_mypy.py
test__get_differences_from_base
30
null
pfnet/pysen
import argparse import pathlib from typing import Any, Callable, Dict, List, Optional, Sequence import pytest from fakes.component import FakeComponent, Operation from pysen import dumper from pysen.component import ComponentBase from pysen.exceptions import InvalidComponentName from pysen.manifest import Manifest, e...
list(components)
assert
func_call
tests/test_manifest.py
test_components
49
null
pfnet/pysen
import math import pathlib import threading import unittest.mock from typing import Any, Callable, List, Optional, cast import pytest from _pytest.capture import CaptureFixture from fakes.component import FakeCommand, FakeComponent, Operation from fakes.manifest import FakeManifest from pysen.command import CommandBa...
InvalidCommandNameError)
pytest.raises
variable
tests/test_runner.py
test__verify_command_name
388
null
pfnet/pysen
import pathlib from unittest import mock import pytest from pysen.diagnostic import Diagnostic, FLCMFormatter from pysen.reporter import Reporter, ReporterFactory BASE_DIR = pathlib.Path(__file__).resolve().parent def test_reporter() -> None: r = Reporter("fuga") with pytest.raises(AssertionError): ...
"fuga"
assert
string_literal
tests/test_reporter.py
test_reporter
24
null
pfnet/pysen
import dataclasses import pathlib import tempfile from typing import Callable, Iterator, Optional import dacite import pytest from pysen import pyproject from pysen.black import Black from pysen.exceptions import InvalidConfigurationError from pysen.isort import Isort, IsortSectionName from pysen.manifest import Mani...
FILE_PATH
assert
variable
tests/test_pyproject.py
test_find_pyproject
54
null
pfnet/pysen
import pathlib from unittest import mock import pytest from pysen.diagnostic import Diagnostic, FLCMFormatter from pysen.reporter import Reporter, ReporterFactory BASE_DIR = pathlib.Path(__file__).resolve().parent def test_reporter() -> None: r = Reporter("fuga") with pytest.raises(AssertionError): ...
23.4)
pytest.approx
numeric_literal
tests/test_reporter.py
test_reporter
30
null
pfnet/pysen
import dataclasses import logging from typing import Iterator, List, Tuple from unittest import mock import colorlog import pytest from pysen import logging_utils SetupLoggerArgsType = Tuple[logging.Logger, int, logging.Handler] def mock_setup_logger() -> Iterator[List[SetupLoggerArgsType]]: args: List[SetupLog...
None
assert
none_literal
tests/test_logging_utils.py
test_setup
TestReporterLoggingUnit
107
null
pfnet/pysen
import argparse import pathlib import tempfile import unittest.mock from typing import Optional, Sequence import pytest import pysen from pysen import ConfigureLintOptions, configure_lint from pysen.exceptions import CommandNotFoundError from pysen.manifest import Manifest, TargetType from pysen.reporter import Repor...
CommandNotFoundError)
pytest.raises
variable
tests/test_init.py
test_run
59
null
pfnet/pysen
import pathlib import pytest from pysen.plugin import PluginBase from pysen.plugin_loader import load_from_file, load_from_module, load_plugin from pysen.pyproject_model import Config, PluginConfig CURRENT_FILE = pathlib.Path(__file__).resolve() BASE_DIR = CURRENT_FILE.parent def test_load_from_file() -> None: ...
1
assert
numeric_literal
tests/test_plugin_loader.py
test_load_from_file
26
null
pfnet/pysen
import pathlib from unittest import mock import pytest from pysen.diagnostic import Diagnostic, FLCMFormatter from pysen.reporter import Reporter, ReporterFactory BASE_DIR = pathlib.Path(__file__).resolve().parent def test_reporter_report_diagnostics() -> None: r = Reporter("foo") d1 = Diagnostic(pathlib.Pa...
[d1, d2, d3]
assert
collection
tests/test_reporter.py
test_reporter_report_diagnostics
52
null
pfnet/pysen
from pathlib import Path import pytest from pysen.diagnostic import Diagnostic, FLCMFormatter, _format_diagnostic_position def test_diagnostic_post_init() -> None: path = Path("/path/to/file") Diagnostic(file_path=path, message="error") Diagnostic(file_path=path, diff="diff") with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_diagnostic.py
test_diagnostic_post_init
12
null
pfnet/pysen
import collections import pathlib from typing import DefaultDict, Iterator from unittest import mock import pytest from pysen import mypy from pysen.mypy import _get_differences_from_base from pysen.process_utils import add_python_executable from pysen.reporter import Reporter from pysen.runner_options import PathCon...
mypy.MypySetting.very_strict()
assert
func_call
tests/test_mypy.py
test_mypy_setting
35
null
pfnet/pysen
import logging import pathlib from typing import Any, List import dacite import pytest import tomlkit from _pytest.logging import LogCaptureFixture from pysen.factory import MypyModuleOption from pysen.isort import IsortSectionName from pysen.mypy import MypyFollowImports, MypyPreset from pysen.py_version import Pyth...
88
assert
numeric_literal
tests/test_pyproject_model.py
test_example
292
null
pfnet/pysen
import dataclasses import logging from typing import Iterator, List, Tuple from unittest import mock import colorlog import pytest from pysen import logging_utils SetupLoggerArgsType = Tuple[logging.Logger, int, logging.Handler] def mock_setup_logger() -> Iterator[List[SetupLoggerArgsType]]: args: List[SetupLog...
2
assert
numeric_literal
tests/test_logging_utils.py
test_setup_finalize
TestReporterLoggingUnit
148
null
pfnet/pysen
import dataclasses import pathlib import tempfile from typing import Callable, Iterator, Optional import dacite import pytest from pysen import pyproject from pysen.black import Black from pysen.exceptions import InvalidConfigurationError from pysen.isort import Isort, IsortSectionName from pysen.manifest import Mani...
88
assert
numeric_literal
tests/test_pyproject.py
test_resolve_lint_config_inheritance
125
null
pfnet/pysen
import enum import pathlib from typing import DefaultDict, Dict, List, Optional, Sequence, Tuple from pysen import ComponentBase from pysen.command import CommandBase from pysen.diagnostic import Diagnostic from pysen.reporter import Reporter from pysen.runner_options import PathContext, RunOptions from pysen.setting ...
self._expected_settings_dir
assert
complex_expr
tests/fakes/component.py
export_settings
FakeComponent
83
null
pfnet/pysen
import dataclasses import pathlib import tempfile from typing import Callable, Iterator, Optional import dacite import pytest from pysen import pyproject from pysen.black import Black from pysen.exceptions import InvalidConfigurationError from pysen.isort import Isort, IsortSectionName from pysen.manifest import Mani...
str(ex.value)
assert
func_call
tests/test_pyproject.py
test_resolve_lint_config_inheritance
134
null
pfnet/pysen
import contextlib import pathlib import tempfile from typing import Iterator, Set import git import pytest import tomlkit from pysen.path import change_dir from pysen.source import ( PythonFileFilter, Source, SourceEntrySetting, _resolve, extension_filter, ) BASE_DIR = pathlib.Path(__file__).reso...
0
assert
numeric_literal
tests/test_source.py
test__resolve
72
null
pfnet/pysen
import pytest import tomlkit from pysen.pyproject_model import _get_descendant from pysen.setting import _create_dict, _traverse_toml def test__traverse_toml() -> None: unordered_document = """ [tool.poetry] hoo=1 [build-system] foo=42 [tool.pysen-cli] bar=43 """ document = tomlkit...
ValueError)
pytest.raises
variable
tests/test_setting.py
test__traverse_toml
28
null
pfnet/pysen
import pathlib import pytest from pysen.plugin import PluginBase from pysen.plugin_loader import load_from_file, load_from_module, load_plugin from pysen.pyproject_model import Config, PluginConfig CURRENT_FILE = pathlib.Path(__file__).resolve() BASE_DIR = CURRENT_FILE.parent def test_load_plugin() -> None: def...
"create")
assert_*
string_literal
tests/test_plugin_loader.py
test_load_plugin
64
null
pfnet/pysen
import contextlib import pathlib import tempfile from typing import Iterator, Set import git import pytest import tomlkit from pysen.path import change_dir from pysen.source import ( PythonFileFilter, Source, SourceEntrySetting, _resolve, extension_filter, ) BASE_DIR = pathlib.Path(__file__).reso...
expected_tracked
assert
variable
tests/test_source.py
test_resolve_files_root_dot
196
null
pfnet/pysen
import io import logging import os import pathlib import sys import tempfile from typing import List import pytest from pysen.process_utils import _read_stream, run from pysen.reporter import Reporter SAMPLE_DATA = """BytesIO example string. Motivation-Driven Learn or Die Proud, but Humble Boldly do what no one has...
0
assert
numeric_literal
tests/test_process_utils.py
test_run
136
null
pfnet/pysen
import pathlib import subprocess import tempfile import unittest.mock from typing import Iterator, List import pytest from pysen.command import check_command_installed from pysen.exceptions import CommandNotFoundError def invalid_command() -> Iterator[List[str]]: with tempfile.TemporaryDirectory() as td: ...
CommandNotFoundError)
pytest.raises
variable
tests/test_command.py
test_check_command_installed
22
null
pfnet/pysen
import pytest from pysen.py_version import PythonVersion, VersionRepresentation def test_version_ops() -> None: assert VersionRepresentation(3, 6) == VersionRepresentation(3, 6, None, None) with pytest.raises(
NotImplementedError)
pytest.raises
variable
tests/test_py_version.py
test_version_ops
29
null
pfnet/pysen
from pysen.black import Black from pysen.factory import ConfigureLintOptions, configure_lint from pysen.source import Source def test_configure_lint_default_source() -> None: components = configure_lint(ConfigureLintOptions(enable_black=True, source=None)) assert len(components) ==
1
assert
numeric_literal
tests/test_factory.py
test_configure_lint_default_source
8
null
pfnet/pysen
import io import logging import os import pathlib import sys import tempfile from typing import List import pytest from pysen.process_utils import _read_stream, run from pysen.reporter import Reporter SAMPLE_DATA = """BytesIO example string. Motivation-Driven Learn or Die Proud, but Humble Boldly do what no one has...
expected_utf8
assert
variable
tests/test_process_utils.py
test_run_encoding
115
null
pfnet/pysen
from pathlib import Path from unittest import mock from pysen.error_lines import parse_error_diffs, parse_error_lines from pysen.ext.black_wrapper import _parse_file_path std_err1 = "/path/to/file1.py:70:5: error: Missing return statement [return]\n" std_err2 = "/path/to/file2.py:71:6: error: Missing return statement...
70
assert
numeric_literal
tests/test_error_lines.py
test_standard_parser
88
null
pfnet/pysen
import dataclasses import logging from typing import Iterator, List, Tuple from unittest import mock import colorlog import pytest from pysen import logging_utils SetupLoggerArgsType = Tuple[logging.Logger, int, logging.Handler] def mock_setup_logger() -> Iterator[List[SetupLoggerArgsType]]: args: List[SetupLog...
logging_utils._logging_output_colors
assert
complex_expr
tests/test_logging_utils.py
test_setup
TestReporterLoggingUnit
100
null
pfnet/pysen
import pytest import tomlkit from pysen.pyproject_model import _get_descendant from pysen.setting import _create_dict, _traverse_toml def test__create_dict() -> None: assert _create_dict([]) == {} assert _create_dict(["foo"]) == {"foo": {}} assert _create_dict(["foo", "bar"]) ==
{"foo": {"bar": {}}}
assert
collection
tests/test_setting.py
test__create_dict
11
null
pfnet/pysen
from importlib.metadata import PackageNotFoundError from pathlib import Path from unittest import mock import pytest from pysen.exceptions import ( DistributionNotFound, IncompatibleVersionError, UnexpectedErrorFormat, ) from pysen.ext.isort_wrapper import ( IsortSectionName, IsortSetting, _ch...
3
assert
numeric_literal
tests/test_isort.py
test_to_black_compatible
62
null
pfnet/pysen
import argparse import pathlib from typing import Dict, List, Mapping, Optional, Sequence from pysen.command import CommandBase from pysen.manifest import ( ComponentName, ManifestBase, ParserType, TargetName, TargetType, ) from pysen.runner_options import PathContext, RunOptions class FakeManifes...
self._expected_settings_dir
assert
complex_expr
tests/fakes/manifest.py
export_settings
FakeManifest
53
null
pfnet/pysen
from importlib.metadata import PackageNotFoundError from pathlib import Path from unittest import mock import pytest from pysen.exceptions import ( DistributionNotFound, IncompatibleVersionError, UnexpectedErrorFormat, ) from pysen.ext.isort_wrapper import ( IsortSectionName, IsortSetting, _ch...
IncompatibleVersionError)
pytest.raises
variable
tests/test_isort.py
test__get_isort_version
111
null