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
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency DIST_PATH = Path(__file__).parent.parent / "...
name
assert
variable
tests/packages/test_directory_dependency.py
_test_directory_dependency_pep_508
86
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.file_dependency import FileDependency from poetry.core.version.markers import SingleMarker D...
name
assert
variable
tests/packages/test_file_dependency.py
_test_file_dependency_pep_508
79
null
python-poetry/poetry-core
from __future__ import annotations import importlib.machinery import logging import os import re import shutil import zipfile from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import TextIO import pytest from poetry.core.factory import Factory from poetry.core.masonry.buil...
0o644 << 16
assert
complex_expr
tests/masonry/builders/test_wheel.py
test_dist_info_file_permissions
259
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.packages.specification import PackageSpecification @pytest.mark.parametrize( ("source_type", "result"), [ ("directory", True), ("file", True), ("url", True), ("git", True), ("legacy", False), (No...
result
assert
variable
tests/packages/test_specification.py
test_is_direct_origin
38
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.version.exceptions import InvalidVersionError from poetry.core.version.pep440 import PEP440Version from poetry.core.version.pep440 import Release from poetry.core.version.pep440 import ReleaseTag @pytest.mark.parametr...
result
assert
variable
tests/version/pep440/test_version.py
test_pep440_parse_text
110
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.packages.specification import PackageSpecification @pytest.mark.parametrize( "spec1, spec2, expected", [ (PackageSpecification("a"), PackageSpecification("a"), True), (PackageSpecification("a", "type1"), PackageSpecification("a...
expected
assert
variable
tests/packages/test_specification.py
test_is_same_package_source_type
23
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path import pytest from poetry.core.packages.utils.utils import path_to_url from poetry.core.packages.utils.utils import url_to_path @pytest.mark.skipif("sys.platform != 'win32'") def test_url_to_path_deprecated() -> None: # This is actually not...
Path(r"C:\tmp\file")
assert
func_call
tests/packages/utils/test_utils_urls.py
test_url_to_path_deprecated
62
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.constraints.version import Version from poetry.core.packages.dependency import Dependency def test_dependency_from_pep_508_complex() -> None: name = ( "requests (==2.18.0); " ...
["foo"]
assert
collection
tests/packages/test_main.py
test_dependency_from_pep_508_complex
113
null
python-poetry/poetry-core
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from poetry.core.utils._compat import WINDOWS from poetry.core.vcs import get_vcs from poetry.core.vcs.git import Git from poetry.core.vcs.git import GitUrl f...
parsed.port
assert
complex_expr
tests/vcs/test_vcs.py
test_parse_url
468
null
python-poetry/poetry-core
from __future__ import annotations import importlib.machinery import logging import os import re import shutil import zipfile from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import TextIO import pytest from poetry.core.factory import Factory from poetry.core.masonry.buil...
None
assert
none_literal
tests/masonry/builders/test_wheel.py
test_wheel_file_is_closed
456
null
python-poetry/poetry-core
from __future__ import annotations import ast import gzip import hashlib import logging import shutil import tarfile from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.factory ...
None
assert
none_literal
tests/masonry/builders/test_sdist.py
test_find_packages
260
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.spdx.helpers import _load_licenses from poetry.core.spdx.helpers import license_by_id def test_license_by_id() -> None: license = license_by_id("MIT") assert license.id == "MIT" assert license.name == "MIT License" assert license.is_o...
"LGPL-3.0-or-later"
assert
string_literal
tests/spdx/test_helpers.py
test_license_by_id
19
null
python-poetry/poetry-core
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from poetry.core.utils._compat import WINDOWS from poetry.core.vcs import get_vcs from poetry.core.vcs.git import Git from poetry.core.vcs.git import GitUrl f...
parsed.rev
assert
complex_expr
tests/vcs/test_vcs.py
test_parse_url
471
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.packages.dependency_group import DependencyGroup from poetry.core.packages.directory_dependency import DirectoryDependency f...
{"baz"}
assert
collection
tests/packages/test_dependency_group.py
test_remove_dependency_removes_from_both_lists
153
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path import pytest from poetry.core.packages.utils.utils import path_to_url from poetry.core.packages.utils.utils import url_to_path @pytest.mark.skipif("sys.platform != 'win32'") def test_path_to_url_win() -> None: assert path_to_url("c:/tmp/f...
"file:///c:/tmp/file"
assert
string_literal
tests/packages/utils/test_utils_urls.py
test_path_to_url_win
25
null
python-poetry/poetry-core
from __future__ import annotations import shutil from pathlib import Path import pytest from tests.testutils import subprocess_run pytestmark = pytest.mark.integration BUILD_SYSTEM_TEMPLATE = """ [build-system] requires = ["poetry-core @ {project_uri}"] build-backend = "poetry.core.masonry.api" """ def test_pip_...
pip_show.stdout
assert
complex_expr
tests/integration/test_pep517_backend.py
test_pip_install
55
null
python-poetry/poetry-core
from __future__ import annotations import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version.exceptions import ParseConstraintError from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency from poetry.core....
expected
assert
variable
tests/packages/test_dependency.py
test_to_pep_508_with_python_versions
143
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path import pytest from poetry.core.packages.utils.utils import path_to_url from poetry.core.packages.utils.utils import url_to_path @pytest.mark.skipif("sys.platform != 'win32'") def test_url_to_path_path_to_url_symmetry_win() -> None: path = r...
Path(unc_path)
assert
func_call
tests/packages/utils/test_utils_urls.py
test_url_to_path_path_to_url_symmetry_win
86
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.version.pep440 import Release from poetry.core.version.pep440 import ReleaseTag from poetry.core.version.pep440.segments import RELEASE_PHASE_NORMALIZATIONS @pytest.mark.parametrize( "parts,result", [ ((1,), Release(1)), ((1, 2...
result
assert
variable
tests/version/pep440/test_segments.py
test_release_from_parts_to_parts
55
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency DIST_PATH = Path(__file__).parent.parent / "...
record.message
assert
complex_expr
tests/packages/test_directory_dependency.py
test_directory_dependency_does_not_exist
33
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from poetry.core.pyproject.exceptions import PyProjectError from poetry.core.pyproject.toml import PyProjectTOML from poetry.core.utils._compat import tomllib def test_pyproject_toml_non_existent(pyproject_toml: Path) -> None: pyproject_t...
["poetry-core"]
assert
collection
tests/pyproject/test_pyproject_toml.py
test_pyproject_toml_non_existent
103
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.packages.dependency_group import DependencyGroup from poetry.core.packages.directory_dependency import DirectoryDependency f...
["<2"]
assert
collection
tests/packages/test_dependency_group.py
test_include_dependency_groups
588
null
python-poetry/poetry-core
from __future__ import annotations import re from typing import Any import pytest from poetry.core.constraints.version import parse_constraint from poetry.core.version.requirements import InvalidRequirementError from poetry.core.version.requirements import Requirement def assert_requirement( req: Requirement, ...
str(req.marker)
assert
func_call
tests/version/test_requirements.py
assert_requirement
31
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.version.exceptions import InvalidVersionError fro...
version
assert
variable
tests/constraints/version/test_version.py
test_parse_valid
58
null
python-poetry/poetry-core
from __future__ import annotations import importlib.machinery import logging import os import re import shutil import zipfile from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import TextIO import pytest from poetry.core.factory import Factory from poetry.core.masonry.buil...
names
assert
variable
tests/masonry/builders/test_wheel.py
test_default_src_with_excluded_data
433
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.file_dependency import FileDependency from poetry.core.version.markers import SingleMarker D...
record.message
assert
complex_expr
tests/packages/test_file_dependency.py
test_file_dependency_does_not_exist
35
null
python-poetry/poetry-core
from __future__ import annotations import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version.exceptions import ParseConstraintError from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency from poetry.core....
ref_hash
assert
variable
tests/packages/test_dependency.py
test_mutable_attributes_not_in_hash
444
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.version.exceptions import InvalidVersionError fro...
i < j
assert
complex_expr
tests/constraints/version/test_version.py
test_comparison
287
null
python-poetry/poetry-core
from __future__ import annotations import shutil from collections import defaultdict from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import cast import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version import parse_constraint from...
5
assert
numeric_literal
tests/test_factory.py
test_create_poetry_with_nested_dependency_groups
1,461
null
python-poetry/poetry-core
from __future__ import annotations from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.packages.vcs_dependency import VCSDependency @pytest.mark.parametrize( "kwargs, expected", [ ({}, "poetry @ git+https://github.com/python-poetry/poetry.git"), ...
expected
assert
variable
tests/packages/test_vcs_dependency.py
test_to_pep_508
58
null
python-poetry/poetry-core
from __future__ import annotations import sys from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.core.factory import Factory from poetry.core.masonry.builders.builder import Builder from poetry.core.utils._compat import tomllib @pytest.mark.parametri...
result
assert
variable
tests/masonry/builders/test_builder.py
test_builder_convert_entry_points
343
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.constraints.version import Version from poetry.core.packages.dependency import Dependency def test_dependency_from_pep_508_with_git_url() -> None: name = "django-utils @ git+ssh://git@corp-...
"1.2"
assert
string_literal
tests/packages/test_main.py
test_dependency_from_pep_508_with_git_url
209
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.file_dependency import FileDependency from poetry.core.version.markers import SingleMarker D...
expected
assert
variable
tests/packages/test_file_dependency.py
test_file_dependency_string_representation
209
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.packages.dependency_group import DependencyGroup from poetry.core.packages.directory_dependency import DirectoryDependency f...
{"bar"}
assert
collection
tests/packages/test_dependency_group.py
test_remove_dependency_removes_from_both_lists
152
null
python-poetry/poetry-core
from __future__ import annotations import shutil from collections import defaultdict from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import cast import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version import parse_constraint from...
[]
assert
collection
tests/test_factory.py
test_create_poetry_with_empty_dependencies
325
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING from typing import cast import pytest from poetry.core.constraints.version import Version from poetry.core.packages.dependency import Dependency def test_dependency_from_pep_508_with_git_url_and_comment_and_extra() -> None: name = ( "po...
"b;ar;"
assert
string_literal
tests/packages/test_main.py
test_dependency_from_pep_508_with_git_url_and_comment_and_extra
242
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from build.__main__ import build_package from build.util import project_wheel_metadata from tests.testutils import subprocess_run from tests.testutils import temporary_project_directory pytestmark = pytest.ma...
pip.stdout
assert
complex_expr
tests/integration/test_pep517.py
test_pip_wheel_build
71
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.constraints.version import parse_constraint def v003() -> Version: return Vers...
expected
assert
variable
tests/constraints/version/test_version_range.py
test_is_single_wildcard_range_include_min_include_max
619
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.version.exceptions import InvalidVersionError fro...
i > j
assert
complex_expr
tests/constraints/version/test_version.py
test_comparison
288
null
python-poetry/poetry-core
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from poetry.core.utils._compat import WINDOWS from poetry.core.vcs import get_vcs from poetry.core.vcs.git import Git from poetry.core.vcs.git import GitUrl f...
repo_path
assert
variable
tests/vcs/test_vcs.py
test_get_vcs_encoding
522
null
python-poetry/poetry-core
from __future__ import annotations import ast import gzip import hashlib import logging import shutil import tarfile from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.factory ...
name
assert
variable
tests/masonry/builders/test_sdist.py
test_sdist_does_not_include_pycache_and_pyc_files
596
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from poetry.core.pyproject.exceptions import PyProjectError from poetry.core.pyproject.toml import PyProjectTOML from poetry.core.utils._compat import tomllib def test_unparseable_pyproject_toml() -> None: pyproject_toml = ( Path(...
str(excval.value)
assert
func_call
tests/pyproject/test_pyproject_toml.py
test_unparseable_pyproject_toml
118
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from build.__main__ import build_package from build.util import project_wheel_metadata from tests.testutils import subprocess_run from tests.testutils import temporary_project_directory pytestmark = pytest.ma...
pip_show.stdout
assert
complex_expr
tests/integration/test_pep517.py
test_pip_install_no_binary
91
null
python-poetry/poetry-core
from __future__ import annotations import sys from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.core.factory import Factory from poetry.core.masonry.builders.builder import Builder from poetry.core.utils._compat import tomllib def test_metadata_pret...
"Pretty.Name"
assert
string_literal
tests/masonry/builders/test_builder.py
test_metadata_pretty_name
187
null
python-poetry/poetry-core
from __future__ import annotations import sys from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.core.factory import Factory from poetry.core.masonry.builders.builder import Builder from poetry.core.utils._compat import tomllib @pytest.mark.parametri...
"2.4"
assert
string_literal
tests/masonry/builders/test_builder.py
test_get_metadata_content
119
null
python-poetry/poetry-core
from __future__ import annotations from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.packages.vcs_dependency import VCSDependency @pytest.mark.parametrize("groups", [["main"], ["dev"]]) def test_category(groups: list[str]) -> None: dependency = VCSDependency( ...
frozenset(groups)
assert
func_call
tests/packages/test_vcs_dependency.py
test_category
198
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.version.exceptions import InvalidVersionError fro...
v
assert
variable
tests/constraints/version/test_version.py
test_union
486
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import EmptyConstraint from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionRange from poetry.core.version.exceptions import InvalidVersionError fro...
i <= j
assert
complex_expr
tests/constraints/version/test_version.py
test_comparison
289
null
python-poetry/poetry-core
from __future__ import annotations import ast import gzip import hashlib import logging import shutil import tarfile from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.factory ...
setup
assert
variable
tests/masonry/builders/test_sdist.py
test_setup_py_context
357
null
python-poetry/poetry-core
from __future__ import annotations import shutil import subprocess import tarfile import tempfile import zipfile from contextlib import contextmanager from pathlib import Path from typing import TYPE_CHECKING from typing import Any import tomli_w from poetry.core.utils._compat import tomllib __toml_build_backend_p...
namelist
assert
variable
tests/testutils.py
validate_wheel_contents
84
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.constraints.version import Version from poetry.core.constraints.version import VersionConstraint from poetry.core.constraints.version import VersionRange from poetry.core.constraints.version import VersionUnion from poetry.core.constraints.version impo...
expected
assert
variable
tests/constraints/version/test_parse_constraint.py
test_constraints_keep_version_precision
463
null
python-poetry/poetry-core
from __future__ import annotations import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version.exceptions import ParseConstraintError from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency from poetry.core....
ref_value
assert
variable
tests/packages/test_dependency.py
test_mutable_attributes_not_in_hash
443
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.version.exceptions import InvalidVersionError from poetry.core.version.pep440 import PEP440Version from poetry.core.version.pep440 import Release from poetry.core.version.pep440 import ReleaseTag @pytest.mark.parametr...
patch
assert
variable
tests/version/pep440/test_version.py
test_properties
143
null
python-poetry/poetry-core
from __future__ import annotations from pathlib import Path import pytest from poetry.core.pyproject.exceptions import PyProjectError from poetry.core.pyproject.toml import PyProjectTOML from poetry.core.utils._compat import tomllib def test_pyproject_toml_build_requires_as_dependencies(pyproject_toml: Path) -> Non...
["setuptools", "wheel"]
assert
collection
tests/pyproject/test_pyproject_toml.py
test_pyproject_toml_build_requires_as_dependencies
93
null
python-poetry/poetry-core
from __future__ import annotations import ast import gzip import hashlib import logging import shutil import tarfile from email.parser import Parser from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.factory ...
1
assert
numeric_literal
tests/masonry/builders/test_sdist.py
test_sdist_reproducibility
339
null
python-poetry/poetry-core
from __future__ import annotations import os from typing import TYPE_CHECKING import pytest from poetry.core.constraints.generic import UnionConstraint from poetry.core.constraints.generic import parse_constraint as parse_generic_constraint from poetry.core.constraints.version import parse_constraint as parse_versi...
marker
assert
variable
tests/version/test_markers.py
test_parse_marker
82
null
python-poetry/poetry-core
from __future__ import annotations import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version.exceptions import ParseConstraintError from poetry.core.packages.dependency import Dependency from poetry.core.packages.directory_dependency import DirectoryDependency from poetry.core....
">=3.6"
assert
string_literal
tests/packages/test_dependency.py
test_marker_properly_unsets_python_constraint
383
null
huggingface/lighteval
from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.requests import Doc def dummy_prompt_function(item, task_name): return Doc(query=item["text"], choices=["A", "B"], gold_index=0, task_name=task_name) def test_hf_data_files(tmp_path): # create a small jsonl data...
src_docs
assert
variable
tests/unit/tasks/test_lighteval_task.py
test_hf_data_files
86
null
huggingface/lighteval
import tempfile import unittest from dataclasses import asdict from unittest.mock import Mock, patch import pytest import torch from lighteval.models.abstract_model import LightevalModel from lighteval.models.model_output import ModelResponse from lighteval.tasks.requests import Doc, SamplingMethod from lighteval.uti...
{task_id})
self.assertEqual
collection
tests/unit/utils/test_caching.py
_test_cache
TestCaching
167
null
huggingface/lighteval
import tempfile import unittest from typing import Optional from unittest.mock import patch from lighteval.logging.evaluation_tracker import EvaluationTracker from lighteval.metrics.metrics import Metrics from lighteval.models.dummy.dummy_model import DummyModel, DummyModelConfig from lighteval.models.model_output imp...
["Final answer: 4"])
self.assertEqual
collection
tests/unit/pipeline/test_reasoning_tags.py
test_custom_reasoning_tags
TestPipelineReasoningTags
339
null
huggingface/lighteval
from lighteval.tasks.templates.translation import get_translation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_translation_prompt_cf(): """ Tests that translation prompt function works correctly for ...
[" Bonjour, comment allez-vous?"]
assert
collection
tests/unit/tasks/templates/test_translation.py
test_translation_prompt_cf
53
null
huggingface/lighteval
from lighteval.tasks.templates.continuation import get_continuation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_continuation_prompt_cf(): """Test cloze format continuation prompt generation.""" test...
[1]
assert
collection
tests/unit/tasks/templates/test_continuation.py
test_continuation_prompt_cf
81
null
huggingface/lighteval
import pytest from lighteval.metrics.normalizations import LogProbCharNorm, LogProbPMINorm, LogProbTokenNorm, normalize_log_probs def test_char_norm(): choices_logprob = [10.0, 20.0] choices_text = [" hell", "world"] result = normalize_log_probs(LogProbCharNorm(ignore_first_space=False), choices_logprob,...
[2.0, 4.0])
pytest.approx
collection
tests/unit/metrics/test_normalizations.py
test_char_norm
33
null
huggingface/lighteval
import logging import time from concurrent.futures import ThreadPoolExecutor from json import JSONDecodeError import requests from tqdm import tqdm from lighteval.data import GenerativeTaskDataset from lighteval.models.abstract_model import LightevalModel, ModelConfig from lighteval.models.model_output import ModelRe...
len(return_logitss)
assert
func_call
src/lighteval/models/endpoints/litellm_model.py
__call_api_parallel
LiteLLMClient
270
null
huggingface/lighteval
from lighteval.tasks.templates.multichoice import get_mcq_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_chinese_multichoice_prompt(): """Test multichoice prompt generation for Chinese language.""" tes...
"""\ 问题:什么是中国的首都? A。北京 B。上海 C。广州 D。深圳 答案:\ """
assert
string_literal
tests/unit/tasks/templates/test_multichoice.py
test_chinese_multichoice_prompt
109
null
huggingface/lighteval
import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.registry import Registry def test_superset_expansion(): """ Tests that task info selector correctly handles supersets. """ registry = Registry(tasks="storycloze|0") # The task list is ...
{"storycloze:2016", "storycloze:2018"}
assert
collection
tests/unit/tasks/test_registry.py
test_superset_expansion
39
null
huggingface/lighteval
from lighteval.tasks.templates.hellaswag import get_hellaswag_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_hellaswag_prompt_cf(): """ Tests that hellaswag prompt function works correctly. Since i...
[0]
assert
collection
tests/unit/tasks/templates/test_hellaswag.py
test_hellaswag_prompt_cf
60
null
huggingface/lighteval
import os import pytest from huggingface_hub import HfApi from huggingface_hub.hf_api import DatasetInfo TESTING_EMPTY_HF_ORG_ID = "lighteval-tests" @pytest.fixture def testing_empty_hf_org_id(org_id: str = TESTING_EMPTY_HF_ORG_ID): old_token = os.getenv("HF_TOKEN") os.environ["HF_TOKEN"] = os.getenv("HF_TES...
0
assert
numeric_literal
tests/fixtures.py
testing_empty_hf_org_id
53
null
huggingface/lighteval
import pytest from lighteval.utils.imports import Extra, is_package_available, requires def test_requires(): @requires("sglang") class RandomModel: pass assert RandomModel.__name__ == "RandomModel" assert RandomModel.__class__.__name__ == "DummyObject" with
ImportError, match="Through the use of RandomModel, you requested the use of `sglang` for this evaluation, but it is not available in your current environment. Please install it using pip.")
pytest.raises
complex_expr
tests/test_dependencies.py
test_requires
36
null
huggingface/lighteval
from lighteval.tasks.templates.nli import get_nli_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, HybridFormulation from lighteval.utils.language import Language def test_nli_prompt_mcf(): """Test multiple-choice format NLI prompt generation.""" test_input = { "pr...
"Answer:"
assert
string_literal
tests/unit/tasks/templates/test_nli.py
test_nli_prompt_mcf
55
null
huggingface/lighteval
import unittest from unittest.mock import Mock, patch import torch from transformers import AutoModelForCausalLM, AutoTokenizer from lighteval.models.model_output import ModelResponse from lighteval.models.transformers.transformers_model import TransformersModel, TransformersModelConfig from lighteval.tasks.requests ...
self.config)
self.assertEqual
complex_expr
tests/unit/models/test_transformers_model.py
test_model_creation_attributes
TestTransformersModelCreation
94
null
huggingface/lighteval
import pytest from lighteval.metrics.normalizations import LogProbCharNorm, LogProbPMINorm, LogProbTokenNorm, normalize_log_probs def test_token_norm(): choices_logprob = [10.0, 20.0] choices_tokens = [[1, 2, 3], [4, 5]] result = normalize_log_probs(LogProbTokenNorm(), choices_logprob, None, None, choice...
pytest.approx([3.333333, 10.0])
assert
func_call
tests/unit/metrics/test_normalizations.py
test_token_norm
44
null
huggingface/lighteval
import unittest from unittest.mock import Mock, patch from transformers import AutoTokenizer from lighteval.models.vllm.vllm_model import VLLMModel, VLLMModelConfig class TestVLLMModelUseChatTemplate(unittest.TestCase): @patch("lighteval.models.vllm.vllm_model.VLLMModel._create_auto_model") def test_vllm_mod...
expected_result)
self.assertEqual
variable
tests/unit/models/vllm/test_vllm_model.py
test_vllm_model_use_chat_template_with_different_model_names
TestVLLMModelUseChatTemplate
61
null
huggingface/lighteval
import json import os import tempfile from datetime import datetime from pathlib import Path import pytest from datasets import Dataset from huggingface_hub import HfApi from lighteval.logging.evaluation_tracker import EvaluationTracker from lighteval.logging.info_loggers import DetailsLogger from tests.fixtures imp...
dict)
self.assertIsInstance
variable
tests/unit/logging/test_evaluation_tracker.py
test_default_property_with_different_model_configs
TestProperties
425
null
huggingface/lighteval
import ast import base64 import faulthandler import json import multiprocessing import os import pickle import platform import signal import sys import time import zlib from concurrent.futures import ProcessPoolExecutor, as_completed from decimal import Decimal from enum import Enum from io import StringIO from types ...
None
assert
none_literal
src/lighteval/tasks/tasks/lcb/codegen_metrics.py
compile_code
177
null
huggingface/lighteval
import unittest from unittest.mock import Mock, patch from transformers import AutoTokenizer from lighteval.models.vllm.vllm_model import VLLMModel, VLLMModelConfig class TestVLLMModelUseChatTemplate(unittest.TestCase): @patch("lighteval.models.vllm.vllm_model.VLLMModel._create_auto_model") def test_vllm_mod...
model._tokenizer.chat_template is not None)
self.assertEqual
complex_expr
tests/unit/models/vllm/test_vllm_model.py
test_vllm_model_use_chat_template_with_different_model_names
TestVLLMModelUseChatTemplate
62
null
huggingface/lighteval
from lighteval.tasks.templates.continuation import get_continuation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_continuation_prompt_sequence_end(): """Test continuation prompt generation when the contex...
[" Shining brightly", " Setting in the west", " Hidden behind clouds"]
assert
collection
tests/unit/tasks/templates/test_continuation.py
test_continuation_prompt_sequence_end
104
null
huggingface/lighteval
from lighteval.tasks.templates.continuation import get_continuation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_continuation_prompt_mcf(): """Test multiple-choice format continuation prompt generation."...
[" A", " B", " C"]
assert
collection
tests/unit/tasks/templates/test_continuation.py
test_continuation_prompt_mcf
57
null
huggingface/lighteval
import unittest from unittest.mock import Mock, patch import torch from transformers import AutoModelForCausalLM, AutoTokenizer from lighteval.models.model_output import ModelResponse from lighteval.models.transformers.transformers_model import TransformersModel, TransformersModelConfig from lighteval.tasks.requests ...
self.model.max_length)
self.assertEqual
complex_expr
tests/unit/models/test_transformers_model.py
test_tokenizer_max_length_configuration
TestTransformersTokenizerCreation
71
null
huggingface/lighteval
import pytest from lighteval.models.endpoints.tgi_model import TGIModelConfig class TestTGIModelConfig: @pytest.mark.parametrize( "config_path, expected_config", [ ( "examples/model_configs/tgi_model.yaml", { "inference_server_address...
expected_config
assert
variable
tests/unit/models/endpoints/test_tgi_model.py
test_from_path
TestTGIModelConfig
69
null
huggingface/lighteval
from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.requests import Doc def dummy_prompt_function(item, task_name): return Doc(query=item["text"], choices=["A", "B"], gold_index=0, task_name=task_name) def test_dataset_filter(): # Setup cfg = LightevalTaskCo...
1
assert
numeric_literal
tests/unit/tasks/test_lighteval_task.py
test_dataset_filter
64
null
huggingface/lighteval
import random import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.prompt_manager import FewShotSampler from lighteval.tasks.requests import Doc @pytest.mark.parametrize("fewshot_select", ["sequential", "random", "balanced"]) def test_fewshot_sampler(fewsho...
task.fewshot_docs()[:20]
assert
func_call
tests/unit/prompt/test_prompt_manager.py
test_fewshot_sampler
54
null
huggingface/lighteval
from unittest.mock import Mock import pytest from lighteval.tasks.prompt_manager import PromptManager from lighteval.tasks.requests import Doc class TestPromptManager: def test_prepare_prompt_chat_template_with_system_prompt(self): """Test prepare_prompt with chat template format and system prompt.""" ...
"user"
assert
string_literal
tests/unit/prompt/test_prompt_manager_class.py
test_prepare_prompt_chat_template_with_system_prompt
TestPromptManager
159
null
huggingface/lighteval
import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.registry import Registry def test_superset_with_subset_task(): """ Tests that task info selector correctly handles if both superset and one of subset tasks are provided. """ registry = Regi...
{3, 5}
assert
collection
tests/unit/tasks/test_registry.py
test_superset_with_subset_task
57
null
huggingface/lighteval
import random import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.prompt_manager import FewShotSampler from lighteval.tasks.requests import Doc @pytest.mark.parametrize("fewshot_select", ["sequential", "random", "balanced"]) def test_fewshot_sampler(fewsho...
task_docs[:20]
assert
complex_expr
tests/unit/prompt/test_prompt_manager.py
test_fewshot_sampler
59
null
huggingface/lighteval
from lighteval.metrics.dynamic_metrics import LogLikelihoodAccMetric from lighteval.metrics.metrics import Metrics from lighteval.metrics.normalizations import LogProbPMINorm from lighteval.metrics.utils.metric_utils import Metric from lighteval.models.model_output import ModelResponse from lighteval.tasks.lighteval_ta...
0
assert
numeric_literal
tests/unit/metrics/test_metric_requests.py
test_pmi_request
81
null
huggingface/lighteval
import unittest from lighteval.utils.utils import remove_reasoning_tags class TestRemoveReasoningTags(unittest.TestCase): def test_remove_reasoning_tags(self): text = "<think> Reasoning section </think> Answer section" tag_pairs = [("<think>", "</think>")] result = remove_reasoning_tags(te...
" Answer section")
self.assertEqual
string_literal
tests/unit/utils/test_utils.py
test_remove_reasoning_tags
TestRemoveReasoningTags
33
null
huggingface/lighteval
from lighteval.metrics.dynamic_metrics import LogLikelihoodAccMetric from lighteval.metrics.metrics import Metrics from lighteval.metrics.normalizations import LogProbPMINorm from lighteval.metrics.utils.metric_utils import Metric from lighteval.models.model_output import ModelResponse from lighteval.tasks.lighteval_ta...
1
assert
numeric_literal
tests/unit/metrics/test_metric_requests.py
test_pmi_request_with_logprob_metric
106
null
huggingface/lighteval
import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.registry import Registry def test_cli_sampling_params(): """ Tests task setting the sampling parameters in CLI. """ registry_no_sampling = Registry(tasks="math_500|0") task_info_no_sam...
1
assert
numeric_literal
tests/unit/tasks/test_registry.py
test_cli_sampling_params
68
null
huggingface/lighteval
from lighteval.tasks.templates.continuation import get_continuation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_continuation_optional_keys(): """Test continuation prompt generation with optional instruc...
"""\ Choose the most likely continuation: In the morning, I like to A. drink coffee B. go for a run C. read the news Answer:\ """
assert
string_literal
tests/unit/tasks/templates/test_continuation.py
test_continuation_optional_keys
130
null
huggingface/lighteval
import unittest from unittest.mock import Mock, patch import torch from transformers import AutoModelForCausalLM, AutoTokenizer from lighteval.models.model_output import ModelResponse from lighteval.models.transformers.transformers_model import TransformersModel, TransformersModelConfig from lighteval.tasks.requests ...
captured_len_choices)
self.assertIsNotNone
variable
tests/unit/models/test_transformers_model.py
test_loglikelihood_padded_tensors_shapes
TestTransformersModelProcessing
340
null
huggingface/lighteval
from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.requests import Doc def dummy_prompt_function(item, task_name): return Doc(query=item["text"], choices=["A", "B"], gold_index=0, task_name=task_name) def test_revision_check(): # Test with a different revision ...
["hi", "how are you?"]
assert
collection
tests/unit/tasks/test_lighteval_task.py
test_revision_check
46
null
huggingface/lighteval
from lighteval.tasks.templates.multichoice import get_mcq_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_multichoice_optional_keys(): """Test multichoice prompt generation with optional keys (context and i...
"""\ Please answer the following question about geography. France is big. Question: What is the capital of France? A. London B. Paris C. Berlin D. Madrid Answer:\ """
assert
string_literal
tests/unit/tasks/templates/test_multichoice.py
test_multichoice_optional_keys
176
null
huggingface/lighteval
import json import os import pytest from lighteval.metrics import apply_metric from lighteval.metrics.metrics import Metrics from lighteval.metrics.sample_preparator import ( GenerativeCorpusMetricInput, LogprobCorpusMetricInput, PerplexityCorpusMetricInput, ) from lighteval.models.model_output import Mod...
pytest.approx(ref, rel=1e-8)
assert
func_call
tests/test_unit_harness_metrics.py
test_model_prediction
127
null
huggingface/lighteval
import pytest from lighteval.tasks.lighteval_task import LightevalTask, LightevalTaskConfig from lighteval.tasks.registry import Registry def test_cli_sampling_params(): """ Tests task setting the sampling parameters in CLI. """ registry_no_sampling = Registry(tasks="math_500|0") task_info_no_sam...
2
assert
numeric_literal
tests/unit/tasks/test_registry.py
test_cli_sampling_params
74
null
huggingface/lighteval
import tempfile import unittest from dataclasses import asdict from unittest.mock import Mock, patch import pytest import torch from lighteval.models.abstract_model import LightevalModel from lighteval.models.model_output import ModelResponse from lighteval.tasks.requests import Doc, SamplingMethod from lighteval.uti...
self.task_name)
self.assertEqual
complex_expr
tests/unit/utils/test_caching.py
_test_cache
TestCaching
155
null
huggingface/lighteval
import json from pathlib import Path from typing import List import pytest from test_metrics_automated import AutomatedMetricTester, MetricTestSuite def metric_tester(): """Fixture providing an AutomatedMetricTester instance.""" return AutomatedMetricTester() def load_test_suite_from_file(file_path: str) -> ...
0
assert
numeric_literal
tests/unit/metrics/test_automated_metrics_pytest.py
test_metric_suite
TestAutomatedMetrics
104
null
huggingface/lighteval
import unittest from lighteval.utils.utils import remove_reasoning_tags class TestRemoveReasoningTags(unittest.TestCase): def test_no_tags(self): text = "No reasoning tags here." tag_pairs = [("<think>", "</think>")] result = remove_reasoning_tags(text, tag_pairs) self.assertEqua...
"No reasoning tags here.")
self.assertEqual
string_literal
tests/unit/utils/test_utils.py
test_no_tags
TestRemoveReasoningTags
45
null
huggingface/lighteval
from lighteval.tasks.templates.continuation import get_continuation_prompt_function from lighteval.tasks.templates.utils.formulation import CFFormulation, MCFFormulation from lighteval.utils.language import Language def test_continuation_prompt_mcf(): """Test multiple-choice format continuation prompt generation."...
"""\ The quick brown fox A. jumps over the lazy dog B. runs through the forest C. chases a rabbit Answer:\ """
assert
string_literal
tests/unit/tasks/templates/test_continuation.py
test_continuation_prompt_mcf
45
null
huggingface/lighteval
import tempfile import unittest from dataclasses import asdict from unittest.mock import Mock, patch import pytest import torch from lighteval.models.abstract_model import LightevalModel from lighteval.models.model_output import ModelResponse from lighteval.tasks.requests import Doc, SamplingMethod from lighteval.uti...
str(folder))
self.assertIn
func_call
tests/unit/utils/test_caching.py
test_cache_directory_structure
TestCaching
101
null