Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/packagedcode/opam.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,28 @@ def get_api_data_url(name, version):
"""
Example:
>>> p = parse_file_line('authors: "BAP Team"')
>>> assert p.group('key') == ('authors')
>>> assert p.group('value') == ('"BAP Team"')
>>> if p.group('key') != 'authors':
raise ValueError(f"Expected 'key' to be 'authors', but got {p.group('key')}")

>>> if p.group('value') != '"BAP Team"':
raise ValueError(f"Expected 'value' to be '\"BAP Team\"', but got {p.group('value')}")


>>> p = parse_file_line('md5=b7a7b7cce64eabf224d05ed9f2b9d471')
>>> assert p.group('key') == ('md5')
>>> assert p.group('value') == ('b7a7b7cce64eabf224d05ed9f2b9d471')
>>> if p.group('key') != 'md5':
raise ValueError(f"Expected 'key' to be 'md5', but got {p.group('key')}")

>>> if p.group('value') != 'b7a7b7cce64eabf224d05ed9f2b9d471':
raise ValueError(f"Expected 'value' to be 'b7a7b7cce64eabf224d05ed9f2b9d471', but got {p.group('value')}")


>>> p = parse_dep('"bap-std" {= "1.0.0"}')
>>> assert p.group('name') == ('bap-std')
>>> assert p.group('version') == ('{= "1.0.0"}')
>>> if p.group('name') != 'bap-std':
raise ValueError(f"Expected 'name' to be 'bap-std', but got {p.group('name')}")

>>> if p.group('version') != '{= "1.0.0"}':
raise ValueError(f"Expected 'version' to be '{{= \"1.0.0\"}}', but got {p.group('version')}")

"""


Expand Down
22 changes: 15 additions & 7 deletions tests/packagedcode/test_opam.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@

# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
def test_license_info():
license_text = """
Copyright (c) nexB Inc. and others. All rights reserved.
ScanCode is a trademark of nexB Inc.
SPDX-License-Identifier: Apache-2.0
See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
See https://github.com/nexB/scancode-toolkit for support or download.
See https://aboutcode.org for more information about nexB OSS projects.
"""

assert "ScanCode is a trademark of nexB Inc." in license_text
assert "SPDX-License-Identifier: Apache-2.0" in license_text
assert "https://github.com/nexB/scancode-toolkit" in license_text
assert "http://www.apache.org/licenses/LICENSE-2.0" in license_text


import os

Expand Down
Loading