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 |
|---|---|---|---|---|---|---|---|---|---|
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... | [] | assert | collection | tests/test_process_utils.py | test__read_stream | 95 | 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 | assert | variable | tests/test_process_utils.py | test__read_stream | 88 | 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... | {tempdir} | assert | collection | tests/test_manifest_builder.py | test__build_external | 46 | 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... | expected | assert | variable | tests/test_mypy.py | test_export_settings | 158 | 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... | 1 | assert | numeric_literal | tests/test_error_lines.py | test_diff_parser | 124 | null | |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | None | assert | none_literal | tests/test_lint_command.py | resolve_files | FakeSource | 49 | null |
pfnet/pysen | import pytest
from pysen.py_version import PythonVersion, VersionRepresentation
def test_version_comp() -> None:
def assert_rhs_is_larger(
lhs: VersionRepresentation, rhs: VersionRepresentation
) -> None:
assert lhs < rhs
assert not rhs < lhs
assert_rhs_is_larger(VersionRepresenta... | VersionRepresentation(0, 5, 1)) | assert_* | func_call | tests/test_py_version.py | test_version_comp | 43 | 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... | 0 | assert | numeric_literal | tests/test_manifest_builder.py | test__build | 66 | null | |
pfnet/pysen | import pathlib
from typing import Optional, Sequence
from pysen import ComponentBase, Manifest, ManifestBase, Source, factory
def build( # type: ignore
components: Sequence[ComponentBase], src_path: Optional[pathlib.Path]
) -> ManifestBase:
assert src_path is not | None | assert | none_literal | tests/fakes/configs/error_builder.py | build | 13 | null | |
pfnet/pysen | import pathlib
import pytest
from pysen.ext.mypy_wrapper import MypyPlugin, MypyTarget, run
from pysen.reporter import Reporter
BASE_DIR = pathlib.Path(__file__).resolve().parent
def test_mypy_plugin() -> None:
script_plugin = MypyPlugin(script=pathlib.Path("/foo/bar/baz"))
script_plugin2 = MypyPlugin(scrip... | "module_x" | assert | string_literal | tests/test_mypy_wrapper.py | test_mypy_plugin | 30 | 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... | VersionRepresentation(5, 1, 2) | assert | func_call | tests/test_isort.py | test__get_isort_version | 109 | 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... | 2 | assert | numeric_literal | tests/test_runner.py | test_get_targets | 106 | 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:
... | "plugin_component1" | assert | string_literal | tests/test_plugin_loader.py | test_load_from_file | 27 | 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 | collection | tests/test_setting.py | test__create_dict | 9 | 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... | dumped | assert | variable | tests/test_manifest.py | test_export_settings | 76 | null | |
pfnet/pysen | import pytest
from pysen.py_version import PythonVersion, VersionRepresentation
def test_version_comp() -> None:
def assert_rhs_is_larger(
lhs: VersionRepresentation, rhs: VersionRepresentation
) -> None:
assert lhs < rhs
assert not rhs < lhs
assert_rhs_is_larger(VersionRepresenta... | VersionRepresentation(0, 6)) | assert_* | func_call | tests/test_py_version.py | test_version_comp | 42 | 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.splitlines() | assert | func_call | tests/test_process_utils.py | test__read_stream | 89 | 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_file] | assert | collection | tests/test_git_utils.py | test_list_indexed_files | 70 | 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... | { "known_third_party": ["alpha", "beta"], "default_section": "THIRDPARTY", "sections": ["FUTURE", "STDLIB"], "line_length": 80, "force_single_line": True, # NOTE(igarashi): the following values are emitted by default "force_grid_wrap": 0, "include_trailing_comma": True, "multi_line_output": 3, "use_parentheses": True, ... | assert | collection | tests/test_isort.py | test_export | 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... | mypy.MypySetting.strict() | assert | func_call | tests/test_mypy.py | test_mypy_setting | 36 | null | |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | "fake" | assert | string_literal | tests/test_lint_command.py | test_lint_command_base | 85 | null | |
pfnet/pysen | import pathlib
import pytest
from pysen.ext.mypy_wrapper import MypyPlugin, MypyTarget, run
from pysen.reporter import Reporter
BASE_DIR = pathlib.Path(__file__).resolve().parent
def test_run_zero_source() -> None:
reporter = Reporter("mypy")
assert run(reporter, BASE_DIR, BASE_DIR, MypyTarget([]), True) =... | 0 | assert | numeric_literal | tests/test_mypy_wrapper.py | test_run_zero_source | 13 | 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": {}}}
... | {"foo": {"bar": {"baz": {}}}} | assert | collection | tests/test_setting.py | test__create_dict | 12 | 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):
... | "piyo" | assert | string_literal | tests/test_reporter.py | test_reporter | 35 | 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... | [] | assert | collection | tests/test_git_utils.py | test_list_indexed_files | 62 | 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... | copied.excludes | assert | complex_expr | tests/test_source.py | test_copy | 348 | 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_base_dir | assert | complex_expr | tests/fakes/component.py | export_settings | FakeComponent | 81 | 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) | assert | func_call | tests/test_py_version.py | test_version_ops | 28 | 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... | ValueError) | pytest.raises | variable | tests/test_init.py | test_run | 79 | null | |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | source | assert | variable | tests/test_lint_command.py | test_lint_command_base | 87 | 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... | ["black1", "black2", "isort1", "isort2", "one", "two"] | assert | collection | tests/test_logging_utils.py | test_grouped_memory_handler | 52 | 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... | reporter) | assert_* | variable | tests/test_mypy.py | test_commands | 112 | 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... | pysen_file | assert | variable | tests/test_pyproject.py | test_find_config | 285 | 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... | None | assert | none_literal | tests/test_pyproject.py | test_load_manifest | 59 | 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... | UnexpectedErrorFormat) | pytest.raises | variable | tests/test_isort.py | test__parse_file_path | 95 | 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:
... | 0 | assert | numeric_literal | tests/test_plugin_loader.py | test_load_from_file | 22 | 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... | 3 | assert | numeric_literal | tests/test_runner.py | test_get_targets | 104 | 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"
asse... | current | assert | variable | tests/test_path.py | test_change_dir | 36 | 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 | string_literal | tests/test_py_version.py | test_python_version | 12 | 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... | 5 | assert | numeric_literal | tests/test_error_lines.py | test_standard_parser | 90 | 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):
assert VersionRepresentation(3, 6) == | "3" | assert | string_literal | tests/test_py_version.py | test_version_ops | 30 | 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... | {"piyo"} | assert | collection | tests/test_source.py | test_copy | 361 | 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... | None | assert | none_literal | tests/test_pyproject_model.py | test__parse_plugin_configs | 55 | 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... | 1 | assert | numeric_literal | tests/test_logging_utils.py | test_setup_finalize | TestReporterLoggingUnit | 133 | 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... | 2 | assert | numeric_literal | tests/test_error_lines.py | test_diff_parser | 122 | null | |
pfnet/pysen | import pathlib
from typing import Optional, Sequence
from pysen import ComponentBase, Manifest, ManifestBase, Source, factory
def build2(
components: Sequence[ComponentBase], src_path: Optional[pathlib.Path]
) -> ManifestBase:
assert src_path is not | None | assert | none_literal | tests/fakes/configs/invalid_interface_builder.py | build2 | 10 | null | |
pfnet/pysen | import pathlib
import pytest
from pysen.ext.mypy_wrapper import MypyPlugin, MypyTarget, run
from pysen.reporter import Reporter
BASE_DIR = pathlib.Path(__file__).resolve().parent
def test_mypy_plugin() -> None:
script_plugin = MypyPlugin(script=pathlib.Path("/foo/bar/baz"))
script_plugin2 = MypyPlugin(scrip... | "bar/baz" | assert | string_literal | tests/test_mypy_wrapper.py | test_mypy_plugin | 29 | null | |
pfnet/pysen | import pathlib
import sys
import pytest
from pysen.py_module import _parse_entry_point, load
CURRENT_FILE = pathlib.Path(__file__).resolve()
BASE_DIR = CURRENT_FILE.parent
def test__parse_entry_point() -> None:
assert _parse_entry_point("hoge") is | None | assert | none_literal | tests/test_py_module.py | test__parse_entry_point | 13 | null | |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | 1 | assert | numeric_literal | tests/test_lint_command.py | test_single_file_lint_command_base | 118 | 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_get_relative_path() -> None:
base_dir = pathlib.Path("/opt/pysen/python/packages")
assert get_relative_path("foo/A", base_dir) == | "foo/A" | assert | string_literal | tests/test_path.py | test_get_relative_path | 10 | null | |
pfnet/pysen | from typing import Any, Dict
from pysen.ext.flake8_wrapper import Flake8Setting
def test_flake8_setting_comment() -> None:
flake8 = Flake8Setting().to_black_compatible()
assert len(flake8._comments) > 0
section_name, section = flake8.export()
assert section_name == | ["flake8"] | assert | collection | tests/test_flake8.py | test_flake8_setting_comment | 10 | 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_factory() -> None:
factory = ReporterFactory()
assert len(factory.reporters... | 0 | assert | numeric_literal | tests/test_reporter.py | test_reporter_factory | 57 | 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... | str | assert | variable | tests/test_source.py | test__resolve | 80 | 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... | 2 | assert | numeric_literal | tests/test_pyproject.py | test_load_manifest | 74 | 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... | 71 | assert | numeric_literal | tests/test_error_lines.py | test_standard_parser | 94 | 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... | 0 | assert | numeric_literal | tests/test_logging_utils.py | test_setup_finalize | TestReporterLoggingUnit | 152 | null |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | 0 | assert | numeric_literal | tests/test_lint_command.py | test_single_file_lint_command_base | 108 | 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_file2} | assert | collection | tests/test_git_utils.py | test_list_indexed_files | 90 | 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... | 1 | assert | numeric_literal | tests/test_pyproject.py | test_load_manifest | 104 | 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] | assert | collection | tests/test_reporter.py | test_reporter_report_diagnostics | 49 | null | |
pfnet/pysen | from pathlib import Path
import pytest
from pysen.diagnostic import Diagnostic, FLCMFormatter, _format_diagnostic_position
def test_diagnostic_formatter() -> None:
path = Path("/path/to/file")
formatter = FLCMFormatter
err = formatter.format(
Diagnostic(
start_line=10,
end... | f"{path.resolve()}:10:3:my_command2: -line1\\n+line2\\n" | assert | string_literal | tests/test_diagnostic.py | test_diagnostic_formatter | 41 | 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... | RuntimeError) | pytest.raises | variable | tests/test_pyproject.py | test_resolve_inheritance | 206 | null | |
pfnet/pysen | from pathlib import Path
from pysen.ext.black_wrapper import _parse_file_path
def test__parse_file_path() -> None:
black_format = (
"path/test_error_line_parser.py 2020-06-01 07:19:58.515112 +0000"
)
assert _parse_file_path(black_format) == | Path("path/test_error_line_parser.py") | assert | func_call | tests/test_black.py | test__parse_file_path | 10 | 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... | py38 | assert | variable | tests/test_py_version.py | test_python_version | 20 | 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_get_relative_path() -> None:
base_dir = pathlib.Path("/opt/pysen/python/packages")
assert get_relative_path("foo/A", base_dir) == "foo/A"
assert get_re... | "../../C" | assert | string_literal | tests/test_path.py | test_get_relative_path | 16 | 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... | [black] | assert | collection | tests/test_manifest_builder.py | test__build | 71 | 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()... | normalize_spaces(expected) | assert | func_call | tests/test_dumper.py | test_dump_toml | 103 | null | |
pfnet/pysen | import pytest
from pysen.py_version import PythonVersion, VersionRepresentation
def test_version_from_str() -> None:
def check_version(s: str, expected: VersionRepresentation) -> None:
actual = VersionRepresentation.from_str(s)
assert actual == expected
assert s == str(expected)
cases... | ValueError) | pytest.raises | variable | tests/test_py_version.py | test_version_from_str | 85 | null | |
pfnet/pysen | import pytest
from pysen.py_version import PythonVersion, VersionRepresentation
def assert_rhs_is_larger(
lhs: VersionRepresentation, rhs: VersionRepresentation
) -> None:
assert lhs < | rhs | assert | variable | tests/test_py_version.py | assert_rhs_is_larger | 37 | 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... | 1 | assert | numeric_literal | tests/test_pyproject_model.py | test__parse_source | 127 | 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... | dumper.dump | assert | complex_expr | tests/test_manifest.py | test_default_dump_handler | 54 | 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... | CommandNotFoundError) | pytest.raises | variable | tests/test_runner.py | test_get_target | 120 | 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_factory() -> None:
factory = ReporterFactory()
assert len(factory.reporters)... | 1 | assert | numeric_literal | tests/test_reporter.py | test_reporter_factory | 65 | 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... | 5 | assert | numeric_literal | tests/test_runner.py | test_parse_manifest_arguments | 142 | null | |
pfnet/pysen | import logging
import pathlib
from tempfile import TemporaryDirectory
from typing import List, Optional, Set
from unittest import mock
from pysen.diagnostic import Diagnostic
from pysen.lint_command import (
LintCommandBase,
SingleFileFormatCommandBase,
SingleFileLintCommandBase,
)
from pysen.reporter impo... | 2 | assert | numeric_literal | tests/test_lint_command.py | test_single_file_lint_command_base | 109 | 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... | Path("/path/to/error_line_parser.py") | assert | func_call | tests/test_isort.py | test__parse_file_path | 94 | 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... | str(ex.value) | assert | func_call | tests/test_manifest_builder.py | test__build_external | 53 | null | |
pfnet/pysen | from pathlib import Path
import pytest
from pysen.diagnostic import Diagnostic, FLCMFormatter, _format_diagnostic_position
def test_diagnostic_formatter() -> None:
path = Path("/path/to/file")
formatter = FLCMFormatter
err = formatter.format(
Diagnostic(
start_line=10,
end... | f"{path.resolve()}:10:3:my_command: line1\\nline2" | assert | string_literal | tests/test_diagnostic.py | test_diagnostic_formatter | 29 | 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... | {"alpha"} | assert | collection | tests/test_pyproject.py | test_load_lint_components | 151 | 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 | none_literal | tests/test_cli_config.py | test_example | 11 | 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... | out.err | assert | complex_expr | tests/test_runner.py | test_parse_manifest_arguments | 149 | 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_module() -> None:
... | "create_component2" | assert | string_literal | tests/test_plugin_loader.py | test_load_from_module | 49 | 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... | copied.includes | assert | complex_expr | tests/test_source.py | test_copy | 346 | null | |
pfnet/pysen | from typing import Any, Dict
from pysen.ext.flake8_wrapper import Flake8Setting
def test_flake8_setting_comment() -> None:
flake8 = Flake8Setting().to_black_compatible()
assert len(flake8._comments) > | 0 | assert | numeric_literal | tests/test_flake8.py | test_flake8_setting_comment | 8 | 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-hoge.fuga.*"] | assert | collection | tests/test_mypy.py | test_mypy_setting | 48 | 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... | str(e) | assert | func_call | tests/test_manifest.py | test_get_targets | 120 | 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... | KeyError) | pytest.raises | variable | tests/test_source.py | test_add_remove | 115 | 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_get_relative_path() -> None:
base_dir = pathlib.Path("/opt/pysen/python/packages")
assert get_relative_path("foo/A", base_dir) == "foo/A"
assert get_re... | "../foo/B" | assert | string_literal | tests/test_path.py | test_get_relative_path | 13 | 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:
... | 127 | assert | numeric_literal | tests/test_command.py | test_check_command_installed | 26 | 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"
ass... | "py38" | assert | string_literal | tests/test_py_version.py | test_python_version | 14 | null | |
pfnet/pysen | import pytest
from pysen.py_version import PythonVersion, VersionRepresentation
def test_version_comp() -> None:
def assert_rhs_is_larger(
lhs: VersionRepresentation, rhs: VersionRepresentation
) -> None:
assert lhs < rhs
assert not rhs < lhs
assert_rhs_is_larger(VersionRepresent... | VersionRepresentation(1, 2, 3)) | assert_* | func_call | tests/test_py_version.py | test_version_comp | 40 | 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... | formatter | assert | variable | tests/test_logging_utils.py | test_grouped_memory_handler | 56 | 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... | str(e) | assert | func_call | tests/test_isort.py | test__get_isort_version | 114 | 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... | ["alpha"] | assert | collection | tests/test_pyproject.py | test_resolve_lint_config_inheritance | 124 | 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... | test_source | assert | variable | tests/test_manifest_builder.py | test__build_external | 39 | null | |
pycontribs/jenkinsapi | import time
import logging
import pytest
from jenkinsapi_tests.test_utils.random_strings import random_string
from jenkinsapi.credentials import Credentials
from jenkinsapi.credentials import UsernamePasswordCredential
from jenkinsapi.credentials import SecretTextCredential
from jenkinsapi.credential import SSHKeyCrede... | "" | assert | string_literal | jenkinsapi_tests/systests/test_credentials.py | test_create_user_pass_credential | 66 | null | |
pycontribs/jenkinsapi | import pytest
from mock import Mock, patch, call
from requests.exceptions import HTTPError
from jenkinsapi.artifact import Artifact
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.fingerprint import Fingerprint
from jenkinsapi.custom_exceptions import ArtifactBroken
def artifact(mocker):
return Arti... | ArtifactBroken) | pytest.raises | variable | jenkinsapi_tests/unittests/test_artifact.py | test_verify_dl_valid_negative_strict | 114 | null | |
pycontribs/jenkinsapi | import pytest
from jenkinsapi.node import Node
DATA = {
"actions": [],
"displayName": "bobnit",
"executors": [{}],
"icon": "computer.png",
"idle": True,
"jnlpAgent": False,
"launchSupported": True,
"loadStatistics": {},
"manualLaunchAllowed": True,
"monitorData": {
"huds... | expected_value | assert | variable | jenkinsapi_tests/unittests/test_node.py | test_available_physical_memory | 71 | null | |
pycontribs/jenkinsapi | import pytest
from mock import Mock, patch, call
from requests.exceptions import HTTPError
from jenkinsapi.artifact import Artifact
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.fingerprint import Fingerprint
from jenkinsapi.custom_exceptions import ArtifactBroken
def artifact(mocker):
return Arti... | "/tmp/artifact.zip") | assert_* | string_literal | jenkinsapi_tests/unittests/test_artifact.py | test_save_has_valid_local_copy | ArtifactTest | 168 | null |
pycontribs/jenkinsapi | import time
import logging
import pytest
from jenkinsapi_tests.test_utils.random_strings import random_string
from jenkinsapi.credentials import Credentials
from jenkinsapi.credentials import UsernamePasswordCredential
from jenkinsapi.credentials import SecretTextCredential
from jenkinsapi.credential import SSHKeyCrede... | "anotheruser" | assert | string_literal | jenkinsapi_tests/systests/test_credentials.py | test_update_user_pass_credential | 105 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.