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
pdm-project/pdm
import os import shutil import sys from pathlib import Path import pytest from pdm.cli.commands.use import Command as UseCommand from pdm.exceptions import NoPythonVersion from pdm.models.caches import JSONFileCache @pytest.mark.skipif(os.name != "posix", reason="Run on POSIX platforms only") def test_use_wrapper_py...
Path(sys.executable)
assert
func_call
tests/cli/test_use.py
test_use_wrapper_python
44
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
"2.1"
assert
string_literal
tests/resolver/test_resolve.py
test_resolve_conflicting_dependencies_with_overrides
228
null
pdm-project/pdm
import json import os import subprocess import textwrap from pathlib import Path from tempfile import TemporaryDirectory import pytest from pdm import termui from pdm.cli import actions from pdm.cli.utils import get_pep582_path from pdm.utils import cd def _args(project): (project.root / "args.py").write_text( ...
0
assert
numeric_literal
tests/cli/test_run.py
test_pep582_launcher_for_python_interpreter
34
null
pdm-project/pdm
import pathlib import sys import unittest.mock as mock from datetime import datetime, timezone from pathlib import Path import pytest import tomlkit from pdm import utils from pdm._types import RepositoryConfig from pdm.cli import utils as cli_utils from pdm.cli.filters import GroupSelection from pdm.exceptions impor...
True
assert
bool_literal
tests/test_utils.py
test_is_egg_link
TestIsEditable
369
null
pdm-project/pdm
from itertools import chain from unittest import mock import pytest from pdm import signals from pdm.models.candidates import Candidate from pdm.models.repositories import Package from pdm.models.requirements import Requirement @pytest.mark.usefixtures("working_set") def test_lock_and_install_signals_injection_with_...
1
assert
numeric_literal
tests/test_signals.py
test_lock_and_install_signals_injection_with_add
49
null
pdm-project/pdm
import base64 import os from argparse import Namespace import pytest from pdm._types import RepositoryConfig from pdm.cli.commands.publish import Command as PublishCommand from pdm.cli.commands.publish.package import PackageFile from pdm.cli.commands.publish.repository import Repository from pdm.exceptions import Pdm...
"demo"
assert
string_literal
tests/cli/test_publish.py
test_package_parse_metadata
26
null
pdm-project/pdm
import findpython import pytest from pdm.utils import cd DEFAULT_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] PYPROJECT = { "project": {"name": "test-project", "version": "0.1.0", "requires-python": ">=3.7"}, "build-system": {"requires": ["pdm-backend"], "build-backend": "pdm.backend"}, }...
PYTHON_VERSIONS[1]
assert
complex_expr
tests/test_integration.py
test_use_python_write_file
54
null
pdm-project/pdm
from __future__ import annotations import os import sys import venv from pathlib import Path from typing import TYPE_CHECKING import pytest from pbs_installer import PythonVersion from pytest_httpserver import HTTPServer from pdm.environments import PythonEnvironment from pdm.exceptions import PdmException, ProjectE...
None
assert
none_literal
tests/test_project.py
test_create_venv_first_time
237
null
pdm-project/pdm
from pathlib import Path from unittest.mock import ANY import pytest from unearth import Link from pdm.cli import actions from pdm.exceptions import PdmUsageError from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.project.lockfile import FLAG_CROSS_PLATFORM from...
0
assert
numeric_literal
tests/cli/test_lock.py
test_lock_refresh
49
null
pdm-project/pdm
import tarfile import zipfile from unittest import mock import pytest from pdm.cli.commands.build import Command pytestmark = pytest.mark.usefixtures("local_finder") def get_tarball_names(path): with tarfile.open(path, "r:gz") as tar: return tar.getnames() def get_wheel_names(path): with zipfile.Zi...
1
assert
numeric_literal
tests/cli/test_build.py
test_build_with_no_isolation
165
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
"1.0"
assert
string_literal
tests/resolver/test_resolve.py
test_resolve_record_markers
415
null
pdm-project/pdm
from itertools import chain from unittest import mock import pytest from pdm import signals from pdm.models.candidates import Candidate from pdm.models.repositories import Package from pdm.models.requirements import Requirement @pytest.mark.usefixtures("working_set") def test_lock_and_install_signals_injection_with_...
5
assert
numeric_literal
tests/test_signals.py
test_lock_and_install_signals_injection_with_add
53
null
pdm-project/pdm
from types import SimpleNamespace from unittest.mock import ANY import pytest from pdm.cli.commands import self_cmd def mock_distribution(metadata, entry_points=()): entry_points = (SimpleNamespace(group=ep) for ep in entry_points) return SimpleNamespace(metadata=metadata, entry_points=entry_points) def moc...
["bar", "baz", "foo"]
assert
collection
tests/cli/test_self_command.py
test_self_list
44
null
pdm-project/pdm
from __future__ import annotations import os import pytest from pdm.models.requirements import RequirementError, filter_requirements_with_extras, parse_requirement from tests import FIXTURES FILE_PREFIX = "file:///" if os.name == "nt" else "file://" REQUIREMENTS = [ ("requests", None), ("requests<2.21.0,>=...
["foo", "baz", 'ping; os_name == "nt"']
assert
collection
tests/models/test_requirements.py
test_filter_requirements_with_extras
114
null
pdm-project/pdm
import json from unittest import mock import pytest from rich.box import ASCII @mock.patch("pdm.termui.ROUNDED", ASCII) @pytest.mark.usefixtures("working_set") def test_outdated(project, pdm, index): pdm(["add", "requests"], obj=project, strict=True, cleanup=False) project.project_config["pypi.url"] = "https:...
result.stdout
assert
complex_expr
tests/cli/test_outdated.py
test_outdated
32
null
pdm-project/pdm
import findpython import pytest from pdm.utils import cd DEFAULT_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] PYPROJECT = { "project": {"name": "test-project", "version": "0.1.0", "requires-python": ">=3.7"}, "build-system": {"requires": ["pdm-backend"], "build-backend": "pdm.backend"}, }...
PYTHON_VERSIONS[0]
assert
complex_expr
tests/test_integration.py
test_use_python_write_file
51
null
pdm-project/pdm
import tarfile import zipfile from unittest import mock import pytest from pdm.cli.commands.build import Command pytestmark = pytest.mark.usefixtures("local_finder") def get_tarball_names(path): with tarfile.open(path, "r:gz") as tar: return tar.getnames() def get_wheel_names(path): with zipfile.Zi...
0
assert
numeric_literal
tests/cli/test_build.py
test_build_global_project_forbidden
41
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_setup_update_truthiness_semantics(): base = Setup(name="foo", install_requires=["a"], summary=None) other = Setup(name=None, install_requir...
"foo"
assert
string_literal
tests/models/test_setup_parsing_extra.py
test_setup_update_truthiness_semantics
15
null
pdm-project/pdm
import pytest from pdm.models.versions import InvalidPyVersion, Version def test_support_prerelease_version() -> None: assert not Version("3.9.0").is_prerelease v = Version("3.9.0a4") assert v.is_prerelease assert str(v) == "3.9.0a4" assert v.complete() == v assert v.bump() == Version("3.9.0a5...
Version("3.9.1")
assert
func_call
tests/models/test_versions.py
test_support_prerelease_version
18
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_setup_update_truthiness_semantics(): base = Setup(name="foo", install_requires=["a"], summary=None) other = Setup(name=None, install_requir...
["a"]
assert
collection
tests/models/test_setup_parsing_extra.py
test_setup_update_truthiness_semantics
16
null
pdm-project/pdm
import pytest def test_update_group_not_in_lockfile(project, working_set, pdm): pdm(["add", "requests"], obj=project, strict=True) project.add_dependencies(["pytz"], to_group="extra") result = pdm(["update", "--group", "extra"], obj=project) assert result.exit_code !=
0
assert
numeric_literal
tests/cli/test_update.py
test_update_group_not_in_lockfile
324
null
pdm-project/pdm
import shutil from argparse import Namespace import pytest from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.models.requirements import parse_requirement from pdm.utils import cd from tests import FIXTURES def ns(**kwargs): default_options = { "dev": False, ...
">=3.5"
assert
string_literal
tests/test_formats.py
test_convert_flit
132
null
pdm-project/pdm
import tarfile import zipfile from unittest import mock import pytest from pdm.cli.commands.build import Command pytestmark = pytest.mark.usefixtures("local_finder") def get_tarball_names(path): with tarfile.open(path, "r:gz") as tar: return tar.getnames() def get_wheel_names(path): with zipfile.Zi...
tar_names
assert
variable
tests/cli/test_build.py
test_build_package
82
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_setup_as_dict(): s = Setup( name="n", version="1", install_requires=["a"], extras_require={"x": ["b"]}, python_requires=">=3.8", summar...
"1"
assert
string_literal
tests/models/test_setup_parsing_extra.py
test_setup_as_dict
48
null
pdm-project/pdm
import os import sys from pathlib import Path from types import ModuleType, SimpleNamespace import pytest from pdm.environments.local import PythonLocalEnvironment from pdm.utils import pdm_scheme def local_env(project): # Ensure we construct a fresh local environment for each test env = PythonLocalEnvironme...
exe
assert
variable
tests/environments/test_environment.py
test_which_python_variants
126
null
pdm-project/pdm
import pytest from pdm.models.specifiers import PySpecSet @pytest.mark.parametrize( "left,right,result", [ (">=3.6", ">=3.0", ">=3.0"), ("", ">=3.6", ""), (">=3.6", "<3.7", ""), (">=3.6,<3.8", ">=3.4,<3.7", "<3.8,>=3.4"), ("~=2.7", ">=3.6", "!=3.0.*,!=3.1.*,!=3.2.*,!=3....
result
assert
variable
tests/models/test_specifiers.py
test_pyspec_or_op
65
null
pdm-project/pdm
import shutil from argparse import Namespace import pytest from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.models.requirements import parse_requirement from pdm.utils import cd from tests import FIXTURES def ns(**kwargs): default_options = { "dev": False, ...
"1.0.0"
assert
string_literal
tests/test_formats.py
test_convert_poetry
91
null
pdm-project/pdm
import tarfile import zipfile from unittest import mock import pytest from pdm.cli.commands.build import Command pytestmark = pytest.mark.usefixtures("local_finder") def get_tarball_names(path): with tarfile.open(path, "r:gz") as tar: return tar.getnames() def get_wheel_names(path): with zipfile.Zi...
project)
assert_*
variable
tests/cli/test_build.py
test_build_command
27
null
pdm-project/pdm
import shutil from argparse import Namespace import pytest from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.models.requirements import parse_requirement from pdm.utils import cd from tests import FIXTURES def ns(**kwargs): default_options = { "dev": False, ...
1
assert
numeric_literal
tests/test_formats.py
test_export_pylock_toml
261
null
pdm-project/pdm
import pytest from unearth import Link from pdm.models.cached_package import CachedPackage from tests import FIXTURES def prepare_wheel_cache(project): cache_dir = project.cache("wheels") (cache_dir / "arbitrary/path").mkdir(parents=True) for name in ( "foo-0.1.0.whl", "bar-0.2.0.whl", ...
result.output
assert
complex_expr
tests/cli/test_cache.py
test_cache_list
45
null
pdm-project/pdm
import shutil import pytest from unearth import Link from pdm.models.markers import EnvSpec from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES def test_add_with_prerelease(project, working_set, pdm): pdm(["add", "--prerelease", "--save-compatible", "urllib3...
"1.23b0"
assert
string_literal
tests/cli/test_add.py
test_add_with_prerelease
283
null
pdm-project/pdm
import platform import sys from pathlib import Path import pytest from pbs_installer import PythonVersion from pdm.models.python import PythonInfo from pdm.utils import parse_version def mock_install(mocker): if (arch := platform.machine().lower()) not in ("arm64", "aarch64", "amd64", "x86_64"): pytest.s...
1
assert
numeric_literal
tests/cli/test_python.py
test_use_auto_install_pick_latest
130
null
pdm-project/pdm
import json import os import subprocess import textwrap from pathlib import Path from tempfile import TemporaryDirectory import pytest from pdm import termui from pdm.cli import actions from pdm.cli.utils import get_pep582_path from pdm.utils import cd def _args(project): (project.root / "args.py").write_text( ...
1
assert
numeric_literal
tests/cli/test_run.py
test_run_command_not_found
91
null
pdm-project/pdm
import shutil import pytest from unearth import Link from pdm.models.markers import EnvSpec from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES @pytest.mark.usefixtures("working_set") def test_add_package_unconstrained_rewrite_specifier(project, pdm): projec...
"2.2.9"
assert
string_literal
tests/cli/test_add.py
test_add_package_unconstrained_rewrite_specifier
244
null
pdm-project/pdm
import io import os import shlex import zipfile from pathlib import Path import pytest from pdm.environments.local import PythonLocalEnvironment, _get_shebang_path, _is_console_script, _replace_shebang def test_is_console_script_unix_and_binary(): # Non-Windows path: startswith #! => True assert _is_console...
True
assert
bool_literal
tests/environments/test_shebangs.py
test_is_console_script_unix_and_binary
26
null
pdm-project/pdm
import sys from unittest.mock import ANY import pytest from pdm.compat import tomllib from pdm.models.python import PythonInfo from pdm.utils import cd PYTHON_VERSION = f"{sys.version_info[0]}.{sys.version_info[1]}" def enable_interactive_mode(mocker): from rich import get_console console = get_console() ...
result.stderr
assert
complex_expr
tests/cli/test_init.py
test_init_validate_python_requires
24
null
pdm-project/pdm
from textwrap import dedent import pytest from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement pytestmark = [pytest.mark.network, pytest.mark.uv] def resolve(environment, requirements, target=None): from pdm.resolver.uv import UvResolver reqs = [] for req in requ...
mapping
assert
variable
tests/resolver/test_uv_resolver.py
test_resolve_vcs_requirement
43
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
"1.5"
assert
string_literal
tests/resolver/test_resolve.py
test_resolving_auto_avoid_conflicts
202
null
pdm-project/pdm
import pytest from pdm.models.markers import EnvSpec, get_marker from pdm.models.specifiers import PySpecSet @pytest.mark.parametrize( "original,marker,py_spec", [ ("python_version > '3'", "", ">=3.1"), ("python_version > '3.8'", "", ">=3.9"), ("python_version != '3.8'", "", "!=3.8.*")...
str(a)
assert
func_call
tests/models/test_marker.py
test_split_pyspec
29
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.specifiers import PySpecSet def test_remove_package_with_dry_run(project, working_set, pdm): pdm(["add", "requests"], obj=project, strict=True) result = pdm(["remove", "requests", "--dry-run"], obj=project, strict=True) project._lockfile = None ...
result.output
assert
complex_expr
tests/cli/test_remove.py
test_remove_package_with_dry_run
50
null
pdm-project/pdm
import io import os import shlex import zipfile from pathlib import Path import pytest from pdm.environments.local import PythonLocalEnvironment, _get_shebang_path, _is_console_script, _replace_shebang def _zip_with_main_bytes() -> bytes: buf = io.BytesIO() with zipfile.ZipFile(buf, mode="w") as zf: ...
data
assert
variable
tests/environments/test_shebangs.py
test_replace_shebang_windows_zip_no_change
119
null
pdm-project/pdm
import base64 import os from argparse import Namespace import pytest from pdm._types import RepositoryConfig from pdm.cli.commands.publish import Command as PublishCommand from pdm.cli.commands.publish.package import PackageFile from pdm.cli.commands.publish.repository import Repository from pdm.exceptions import Pdm...
"0.0.1"
assert
string_literal
tests/cli/test_publish.py
test_package_parse_metadata
27
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.specifiers import PySpecSet def test_remove_package_exist_in_multi_groups(project, working_set, pdm): pdm(["add", "requests"], obj=project, strict=True) pdm(["add", "--dev", "urllib3"], obj=project, strict=True) pdm(["remove", "--dev", "urllib3"], ...
project.pyproject._data
assert
complex_expr
tests/cli/test_remove.py
test_remove_package_exist_in_multi_groups
72
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
"1.22"
assert
string_literal
tests/resolver/test_resolve.py
test_resolve_named_requirement
69
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_install_requires_name_resolves_to_non_list(tmp_path): content = textwrap.dedent( """ from setuptools import setup reqs ...
[]
assert
collection
tests/models/test_setup_parsing_extra.py
test_install_requires_name_resolves_to_non_list
331
null
pdm-project/pdm
import shutil from argparse import Namespace import pytest from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.models.requirements import parse_requirement from pdm.utils import cd from tests import FIXTURES def ns(**kwargs): default_options = { "dev": False, ...
2
assert
numeric_literal
tests/test_formats.py
test_convert_requirements_file
53
null
pdm-project/pdm
import shlex import sys from collections import namedtuple from textwrap import dedent import pytest from pdm.cli import actions from pdm.cli.options import from_splitted_env from pdm.signals import pdm_signals pytestmark = pytest.mark.usefixtures("repository", "working_set", "local_finder") def test_pre_and_post_s...
expected
assert
variable
tests/cli/test_hooks.py
test_pre_and_post_scripts
55
null
pdm-project/pdm
import shutil import pytest from unearth import Link from pdm.models.markers import EnvSpec from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES def test_add_package_update_eager(project, repository, pdm): pdm(["add", "--no-sync", "--save-wildcard", "requests...
"3.0.5"
assert
string_literal
tests/cli/test_add.py
test_add_package_update_eager
215
null
pdm-project/pdm
from __future__ import annotations import os import pytest from pdm.models.requirements import RequirementError, filter_requirements_with_extras, parse_requirement from tests import FIXTURES FILE_PREFIX = "file:///" if os.name == "nt" else "file://" REQUIREMENTS = [ ("requests", None), ("requests<2.21.0,>=...
["blah"]
assert
collection
tests/models/test_requirements.py
test_filter_requirements_with_extras
113
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_extras_require_name_is_undefined_returns_empty(tmp_path): content = textwrap.dedent( """ from setuptools import setup s...
{}
assert
collection
tests/models/test_setup_parsing_extra.py
test_extras_require_name_is_undefined_returns_empty
343
null
pdm-project/pdm
from __future__ import annotations import os import sys import venv from pathlib import Path from typing import TYPE_CHECKING import pytest from pbs_installer import PythonVersion from pytest_httpserver import HTTPServer from pdm.environments import PythonEnvironment from pdm.exceptions import PdmException, ProjectE...
expected
assert
variable
tests/test_project.py
test_env_or_setting
488
null
pdm-project/pdm
from __future__ import annotations import shutil import pytest from unearth import Link from pdm.exceptions import RequirementError from pdm.models.candidates import Candidate from pdm.models.requirements import Requirement, parse_requirement from pdm.models.specifiers import PySpecSet from pdm.utils import is_path_...
[]
assert
collection
tests/models/test_candidates.py
test_parse_project_file_on_build_error_no_dep
158
null
pdm-project/pdm
import pathlib import sys import unittest.mock as mock from datetime import datetime, timezone from pathlib import Path import pytest import tomlkit from pdm import utils from pdm._types import RepositoryConfig from pdm.cli import utils as cli_utils from pdm.cli.filters import GroupSelection from pdm.exceptions impor...
dirname
assert
variable
tests/test_utils.py
test_create_tracked_tempdir
41
null
pdm-project/pdm
import json import os import pathlib from unittest import mock import pytest from rich.box import ASCII from pdm.cli.commands.list import Command from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES @mock.patch("pdm.termui.ROUNDED", ASCII) @pytest.mark.usefixture...
result.output
assert
complex_expr
tests/cli/test_list.py
test_list_bare
461
null
pdm-project/pdm
import tarfile import zipfile from unittest import mock import pytest from pdm.cli.commands.build import Command pytestmark = pytest.mark.usefixtures("local_finder") def get_tarball_names(path): with tarfile.open(path, "r:gz") as tar: return tar.getnames() def get_wheel_names(path): with zipfile.Zi...
zip_names
assert
variable
tests/cli/test_build.py
test_build_package
88
null
pdm-project/pdm
import base64 import os from argparse import Namespace import pytest from pdm._types import RepositoryConfig from pdm.cli.commands.publish import Command as PublishCommand from pdm.cli.commands.publish.package import PackageFile from pdm.cli.commands.publish.repository import Repository from pdm.exceptions import Pdm...
result
assert
variable
tests/cli/test_publish.py
test_publish_and_build_in_one_run
129
null
pdm-project/pdm
from __future__ import annotations import os import sys import venv from pathlib import Path from typing import TYPE_CHECKING import pytest from pbs_installer import PythonVersion from pytest_httpserver import HTTPServer from pdm.environments import PythonEnvironment from pdm.exceptions import PdmException, ProjectE...
False
assert
bool_literal
tests/test_project.py
test_configured_source_overwriting
351
null
pdm-project/pdm
import platform import sys from pathlib import Path import pytest from pbs_installer import PythonVersion from pdm.models.python import PythonInfo from pdm.utils import parse_version def mock_install(mocker): if (arch := platform.machine().lower()) not in ("arm64", "aarch64", "amd64", "x86_64"): pytest.s...
0
assert
numeric_literal
tests/cli/test_python.py
test_install_python
75
null
pdm-project/pdm
import os import sys from pathlib import Path from types import ModuleType, SimpleNamespace import pytest from pdm.environments.local import PythonLocalEnvironment from pdm.utils import pdm_scheme def local_env(project): # Ensure we construct a fresh local environment for each test env = PythonLocalEnvironme...
("include", "mypkg")
assert
collection
tests/environments/test_environment.py
test_local_get_paths_headers_override
36
null
pdm-project/pdm
import pytest from pdm.models.specifiers import PySpecSet def test_impossible_pyspec(): spec = PySpecSet(">=3.6,<3.4") a = PySpecSet(">=2.7") assert spec.is_empty() assert (spec & a).is_empty() assert spec | a ==
a
assert
variable
tests/models/test_specifiers.py
test_impossible_pyspec
73
null
pdm-project/pdm
import os import pytest from pdm.cli.templates import ProjectTemplate from pdm.exceptions import PdmException def test_module_project_template(project_no_init): metadata = { "project": {"name": "foo", "version": "0.1.0", "requires-python": ">=3.10"}, "build-system": {"requires": ["pdm-backend"], ...
["idna", "chardet; os_name=='nt'"]
assert
collection
tests/cli/test_template.py
test_module_project_template
28
null
pdm-project/pdm
import os import pytest from pdm.cli.templates import ProjectTemplate from pdm.exceptions import PdmException def test_module_project_template(project_no_init): metadata = { "project": {"name": "foo", "version": "0.1.0", "requires-python": ">=3.10"}, "build-system": {"requires": ["pdm-backend"], ...
">=3.10"
assert
string_literal
tests/cli/test_template.py
test_module_project_template
26
null
pdm-project/pdm
from types import SimpleNamespace from unittest.mock import ANY import pytest from pdm.cli.commands import self_cmd def mock_distribution(metadata, entry_points=()): entry_points = (SimpleNamespace(group=ep) for ep in entry_points) return SimpleNamespace(metadata=metadata, entry_points=entry_points) def moc...
["uninstall", "-y", "demo", "pytz"])
assert_*
collection
tests/cli/test_self_command.py
test_self_remove
85
null
pdm-project/pdm
import sys from unittest import mock import pytest from pdm.cli.commands.base import BaseCommand from pdm.compat import importlib_metadata from pdm.project.config import ConfigItem from pdm.utils import cd def new_command(core): core.register_command(HelloCommand, "hello") def replace_command(core): core.re...
result.output
assert
complex_expr
tests/test_plugin.py
test_plugin_new_command
50
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
result
assert
variable
tests/resolver/test_resolve.py
test_resolve_exclude
83
null
pdm-project/pdm
import os import sys from pathlib import Path from types import ModuleType, SimpleNamespace import pytest from pdm.environments.local import PythonLocalEnvironment from pdm.utils import pdm_scheme def local_env(project): # Ensure we construct a fresh local environment for each test env = PythonLocalEnvironme...
"pip"
assert
string_literal
tests/environments/test_environment.py
test_pip_command_download_fallback
101
null
pdm-project/pdm
import base64 import os from argparse import Namespace import pytest from pdm._types import RepositoryConfig from pdm.cli.commands.publish import Command as PublishCommand from pdm.cli.commands.publish.package import PackageFile from pdm.cli.commands.publish.repository import Repository from pdm.exceptions import Pdm...
"sdist"
assert
string_literal
tests/cli/test_publish.py
test_package_parse_metadata
35
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.markers import EnvSpec from pdm.pytest import Distribution from pdm.utils import cd def test_sync_no_lockfile(project, pdm): project.add_dependencies(["requests"]) result = pdm(["sync"], obj=project) assert result.exit_code ==
1
assert
numeric_literal
tests/cli/test_install.py
test_sync_no_lockfile
34
null
pdm-project/pdm
from __future__ import annotations import os import sys import venv from pathlib import Path from typing import TYPE_CHECKING import pytest from pbs_installer import PythonVersion from pytest_httpserver import HTTPServer from pdm.environments import PythonEnvironment from pdm.exceptions import PdmException, ProjectE...
err
assert
variable
tests/test_project.py
test_select_lockfile_format
564
null
pdm-project/pdm
import logging import textwrap import pytest from pdm.exceptions import ProjectError from pdm.formats import MetaConvertError from pdm.models.setup import Setup def test_setup_as_dict(): s = Setup( name="n", version="1", install_requires=["a"], extras_require={"x": ["b"]}, python_requires=">=3.8", summar...
"n"
assert
string_literal
tests/models/test_setup_parsing_extra.py
test_setup_as_dict
47
null
pdm-project/pdm
import pytest from unearth import Link from pdm.models.cached_package import CachedPackage from tests import FIXTURES def prepare_wheel_cache(project): cache_dir = project.cache("wheels") (cache_dir / "arbitrary/path").mkdir(parents=True) for name in ( "foo-0.1.0.whl", "bar-0.2.0.whl", ...
hash
assert
variable
tests/cli/test_cache.py
test_hash_cache
159
null
pdm-project/pdm
from __future__ import annotations import os import pytest from pdm.models.requirements import RequirementError, filter_requirements_with_extras, parse_requirement from tests import FIXTURES FILE_PREFIX = "file:///" if os.name == "nt" else "file://" REQUIREMENTS = [ ("requests", None), ("requests<2.21.0,>=...
[]
assert
collection
tests/models/test_requirements.py
test_filter_requirements_with_extras
123
null
pdm-project/pdm
import json import os import pathlib from unittest import mock import pytest from rich.box import ASCII from pdm.cli.commands.list import Command from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES def test_list_reverse_without_graph_flag(project, pdm): # re...
result.stderr
assert
complex_expr
tests/cli/test_list.py
test_list_reverse_without_graph_flag
118
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.markers import EnvSpec from pdm.pytest import Distribution from pdm.utils import cd def test_sync_only_different(project, working_set, pdm): working_set.add_distribution(Distribution("foo", "0.1.0")) working_set.add_distribution(Distribution("chardet",...
"3.0.4"
assert
string_literal
tests/cli/test_install.py
test_sync_only_different
73
null
pdm-project/pdm
import sys from unittest.mock import ANY import pytest from pdm.compat import tomllib from pdm.models.python import PythonInfo from pdm.utils import cd PYTHON_VERSION = f"{sys.version_info[0]}.{sys.version_info[1]}" def enable_interactive_mode(mocker): from rich import get_console console = get_console() ...
0
assert
numeric_literal
tests/cli/test_init.py
test_init_validate_python_requires
23
null
pdm-project/pdm
import pytest def test_update_package_with_extras(project, repository, working_set, pdm): repository.add_candidate("foo", "0.1") foo_deps = ["urllib3; extra == 'req'"] repository.add_dependencies("foo", "0.1", foo_deps) pdm(["add", "foo[req]"], obj=project, strict=True) assert working_set["foo"].v...
"0.1"
assert
string_literal
tests/cli/test_update.py
test_update_package_with_extras
300
null
pdm-project/pdm
import pytest from resolvelib.resolvers import ResolutionImpossible from pdm.cli.actions import resolve_candidates_from_lockfile from pdm.exceptions import PackageWarning from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement from pdm.models.specifiers import PySpecSet from pdm.pr...
"2.7"
assert
string_literal
tests/resolver/test_resolve.py
test_resolve_named_requirement
72
null
pdm-project/pdm
import pytest from pdm.models.versions import InvalidPyVersion, Version def test_version_comparison(): assert Version("3.9.0") < Version("3.9.1") assert Version("3.4") < Version("3.9.1") assert Version("3.7.*") < Version("3.7.5") assert Version("3.7") == Version((3, 7)) assert Version("3.9.0a") ...
Version("3.9.0")
assert
func_call
tests/models/test_versions.py
test_version_comparison
32
null
pdm-project/pdm
import pytest @pytest.mark.usefixtures("working_set") def test_update_specified_packages_eager_mode(project, repository, pdm): pdm(["add", "requests", "pytz", "--no-sync"], obj=project, strict=True) repository.add_candidate("pytz", "2019.6") repository.add_candidate("chardet", "3.0.5") repository.add_c...
"3.0.5"
assert
string_literal
tests/cli/test_update.py
test_update_specified_packages_eager_mode
166
null
pdm-project/pdm
import json from pathlib import Path import pytest from pdm.cli import actions from pdm.utils import cd from tests import FIXTURES def test_pep582_option(pdm): result = pdm(["--pep582", "bash"]) assert result.exit_code ==
0
assert
numeric_literal
tests/cli/test_others.py
test_pep582_option
37
null
pdm-project/pdm
import sys from unittest.mock import ANY import pytest from pdm.compat import tomllib from pdm.models.python import PythonInfo from pdm.utils import cd PYTHON_VERSION = f"{sys.version_info[0]}.{sys.version_info[1]}" def enable_interactive_mode(mocker): from rich import get_console console = get_console() ...
data
assert
variable
tests/cli/test_init.py
test_init_command_library
106
null
pdm-project/pdm
from __future__ import annotations import os import pytest from pdm.models.requirements import RequirementError, filter_requirements_with_extras, parse_requirement from tests import FIXTURES FILE_PREFIX = "file:///" if os.name == "nt" else "file://" REQUIREMENTS = [ ("requests", None), ("requests<2.21.0,>=...
result
assert
variable
tests/models/test_requirements.py
test_convert_req_dict_to_req_line
83
null
pdm-project/pdm
import itertools from pdm.resolver.graph import OrderedSet def test_ordered_set(): elems = ["A", "bb", "c3"] all_sets = set() for case in itertools.permutations(elems): s = OrderedSet(case) all_sets.add(s) assert list(s) == list(case) assert len(s) ==
len(case)
assert
func_call
tests/resolver/test_graph.py
test_ordered_set
13
null
pdm-project/pdm
import pytest from pdm.models.markers import EnvSpec, get_marker from pdm.models.specifiers import PySpecSet @pytest.mark.parametrize( "original,marker,py_spec", [ ("python_version > '3'", "", ">=3.1"), ("python_version > '3.8'", "", ">=3.9"), ("python_version != '3.8'", "", "!=3.8.*")...
PySpecSet(py_spec)
assert
func_call
tests/models/test_marker.py
test_split_pyspec
30
null
pdm-project/pdm
import pytest from unearth import Link from pdm.models.cached_package import CachedPackage from tests import FIXTURES def prepare_wheel_cache(project): cache_dir = project.cache("wheels") (cache_dir / "arbitrary/path").mkdir(parents=True) for name in ( "foo-0.1.0.whl", "bar-0.2.0.whl", ...
lines[6]
assert
complex_expr
tests/cli/test_cache.py
test_cache_info
131
null
pdm-project/pdm
import shutil from argparse import Namespace import pytest from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.models.requirements import parse_requirement from pdm.utils import cd from tests import FIXTURES def ns(**kwargs): default_options = { "dev": False, ...
"pyflit"
assert
string_literal
tests/test_formats.py
test_convert_flit
123
null
pdm-project/pdm
from types import SimpleNamespace from unittest.mock import ANY import pytest from pdm.cli.commands import self_cmd def mock_distribution(metadata, entry_points=()): entry_points = (SimpleNamespace(group=ep) for ep in entry_points) return SimpleNamespace(metadata=metadata, entry_points=entry_points) def moc...
0
assert
numeric_literal
tests/cli/test_self_command.py
test_self_list
42
null
pdm-project/pdm
from __future__ import annotations import os import sys import venv from pathlib import Path from typing import TYPE_CHECKING import pytest from pbs_installer import PythonVersion from pytest_httpserver import HTTPServer from pdm.environments import PythonEnvironment from pdm.exceptions import PdmException, ProjectE...
"bar"
assert
string_literal
tests/test_project.py
test_configured_source_overwriting
353
null
pdm-project/pdm
from textwrap import dedent import pytest from pdm.models.markers import EnvSpec from pdm.models.requirements import parse_requirement pytestmark = [pytest.mark.network, pytest.mark.uv] def resolve(environment, requirements, target=None): from pdm.resolver.uv import UvResolver reqs = [] for req in requ...
{"urllib3", "idna", "chardet"}
assert
collection
tests/resolver/test_uv_resolver.py
test_resolve_dependencies_with_nested_extras
72
null
pdm-project/pdm
import os import pytest from pdm.cli.templates import ProjectTemplate from pdm.exceptions import PdmException def test_module_project_template(project_no_init): metadata = { "project": {"name": "foo", "version": "0.1.0", "requires-python": ">=3.10"}, "build-system": {"requires": ["pdm-backend"], ...
"foo"
assert
string_literal
tests/cli/test_template.py
test_module_project_template
25
null
pdm-project/pdm
import pytest def test_update_package_with_extras(project, repository, working_set, pdm): repository.add_candidate("foo", "0.1") foo_deps = ["urllib3; extra == 'req'"] repository.add_dependencies("foo", "0.1", foo_deps) pdm(["add", "foo[req]"], obj=project, strict=True) assert working_set["foo"].ve...
"0.2"
assert
string_literal
tests/cli/test_update.py
test_update_package_with_extras
305
null
pdm-project/pdm
from itertools import chain from unittest import mock import pytest from pdm import signals from pdm.models.candidates import Candidate from pdm.models.repositories import Package from pdm.models.requirements import Requirement def test_post_init_signal(project_no_init, pdm): mock_handler = mock.Mock() with ...
0
assert
numeric_literal
tests/test_signals.py
test_post_init_signal
16
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.markers import EnvSpec from pdm.pytest import Distribution from pdm.utils import cd @pytest.mark.parametrize("nested", [False, True]) @pytest.mark.parametrize("groups", [("default",), None]) def test_install_from_multi_target_lock(project, pdm, repository, nes...
"2.2.9"
assert
string_literal
tests/cli/test_install.py
test_install_from_multi_target_lock
390
null
pdm-project/pdm
from __future__ import annotations import shutil import pytest from unearth import Link from pdm.exceptions import RequirementError from pdm.models.candidates import Candidate from pdm.models.requirements import Requirement, parse_requirement from pdm.models.specifiers import PySpecSet from pdm.utils import is_path_...
"0.0.1"
assert
string_literal
tests/models/test_candidates.py
test_parse_local_directory_metadata
30
null
pdm-project/pdm
import pytest from pdm.cli import actions from pdm.models.specifiers import PySpecSet @pytest.mark.usefixtures("working_set") def test_remove_group_not_in_lockfile(project, pdm, mocker): pdm(["add", "requests"], obj=project, strict=True) project.add_dependencies(["pytz"], to_group="tz") assert project.lo...
["default"]
assert
collection
tests/cli/test_remove.py
test_remove_group_not_in_lockfile
103
null
pdm-project/pdm
import os import pytest from pdm.cli.templates import ProjectTemplate from pdm.exceptions import PdmException def test_module_project_template(project_no_init): metadata = { "project": {"name": "foo", "version": "0.1.0", "requires-python": ">=3.10"}, "build-system": {"requires": ["pdm-backend"], ...
metadata["build-system"]
assert
complex_expr
tests/cli/test_template.py
test_module_project_template
27
null
pdm-project/pdm
import os import sys from pathlib import Path from types import ModuleType, SimpleNamespace import pytest from pdm.environments.local import PythonLocalEnvironment from pdm.utils import pdm_scheme def local_env(project): # Ensure we construct a fresh local environment for each test env = PythonLocalEnvironme...
base
assert
variable
tests/environments/test_environment.py
test_packages_path_compat_suffix_32
28
null
pdm-project/pdm
import shutil import pytest from unearth import Link from pdm.models.markers import EnvSpec from pdm.models.specifiers import PySpecSet from pdm.pytest import Distribution from tests import FIXTURES def test_add_group_with_normalized_name(project, pdm, working_set): project.pyproject.dependency_groups.update({"f...
0
assert
numeric_literal
tests/cli/test_add.py
test_add_group_with_normalized_name
385
null
pdm-project/pdm
import sys from pathlib import Path def test_fix_project_config(project, pdm): project._saved_python = None old_config = project.root / ".pdm.toml" old_config.write_text(f'[python]\nuse_pyenv = false\npath = "{Path(sys.executable).as_posix()}"\n') assert project.project_config["python.use_pyenv"] is
False
assert
bool_literal
tests/cli/test_fix.py
test_fix_project_config
43
null
pdm-project/pdm
import pathlib import sys import unittest.mock as mock from datetime import datetime, timezone from pathlib import Path import pytest import tomlkit from pdm import utils from pdm._types import RepositoryConfig from pdm.cli import utils as cli_utils from pdm.cli.filters import GroupSelection from pdm.exceptions impor...
False
assert
bool_literal
tests/test_utils.py
test_fs_supports_link_method_when_method_doesnt_exist
520
null