tests.test_specifier moduleΒΆ

tests.test_specifier.test_purl_map()[source]ΒΆ
tests.test_specifier.props(spec)[source]ΒΆ

Utility to help compares specifiers between themselves.

I.e. all properties of specifiers are the same but the raw_specs property.

tests.test_specifier.test_parse_specs(spec_string, expected)[source]ΒΆ
tests.test_specifier.PURL_CASES = [{'manager_id': 'apt', 'package_id': 'g++', 'purl': 'pkg:apt/g%2B%2B'}, {'manager_id': 'bin', 'package_id': '/home/user/.local/bin/fzf', 'purl': 'pkg:bin/%2Fhome%2Fuser%2F.local%2Fbin%2Ffzf'}, {'manager_id': 'brew', 'package_id': 'hashicorp/tap/terraform', 'purl': 'pkg:brew/hashicorp/tap/terraform'}, {'manager_id': 'brew', 'package_id': 'python@3.12', 'purl': 'pkg:brew/python%403.12'}, {'manager_id': 'composer', 'package_id': 'monolog/monolog', 'purl': 'pkg:composer/monolog/monolog'}, {'manager_id': 'cpan', 'package_id': 'App::Prove::State::Result::Test', 'purl': 'pkg:cpan/App::Prove::State::Result::Test'}, {'manager_id': 'emerge', 'package_id': 'games-misc/nyancat', 'purl': 'pkg:emerge/games-misc/nyancat'}, {'manager_id': 'gh-ext', 'package_id': 'dlvhdr/gh-dash', 'purl': 'pkg:gh-ext/dlvhdr/gh-dash'}, {'manager_id': 'go', 'package_id': 'github.com/nao1215/gup', 'purl': 'pkg:go/github.com/nao1215/gup'}, {'manager_id': 'julia', 'package_id': 'Example', 'purl': 'pkg:julia/Example'}, {'manager_id': 'npm', 'package_id': '@babel/core', 'purl': 'pkg:npm/%40babel/core'}, {'manager_id': 'npm', 'package_id': 'JSONStream', 'purl': 'pkg:npm/JSONStream'}, {'manager_id': 'vim-pack', 'package_id': 'https://github.com/tpope/vim-sensible', 'purl': 'pkg:vim-pack/https:%2F%2Fgithub.com%2Ftpope%2Fvim-sensible'}]ΒΆ

Manager-tied pURLs shared with tests/gnome/run-tests.js, which holds the GNOME Shell extension’s builder to the same strings.

tests.test_specifier.test_manager_purl_reads_back(case)[source]ΒΆ

A manager-tied pURL renders as the shared table says.

It reads back to the same manager and package.

tests.test_specifier.test_parse_purl(purl, expected)[source]ΒΆ

parse_purl() decodes and normalizes the parts, or refuses a string.

None marks a string that is not a pURL. tests/test_purl_spec.py runs the whole purl-spec test suite.

tests.test_specifier.test_parse_purl_breaking_a_type_rule(purl, lenient)[source]ΒΆ

A pURL breaking a rule of its type is refused, and read outside strict mode.

tests.test_specifier.test_specifier_reads_a_purl_breaking_a_type_rule(caplog)[source]ΒΆ

A pURL breaking a rule of its type resolves, with a warning naming the rule.

tests.test_specifier.test_purl_quote_encodes_a_slash()[source]ΒΆ

A slash inside a segment is encoded.

packageurl-python leaves the one in a name alone.

tests.test_specifier.test_reduce_specs(spec_strings, target_managers, expected)[source]ΒΆ
tests.test_specifier.test_resolve_package_specs(spec_strings, manager_priority, expected)[source]ΒΆ

Distinct explicit managers each survive as their own target.

Alias pURLs, version constraints and manager-less specs still reduce to one.