1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-11-25 23:28:18 +01:00

tests/test_check.py: Add tests for licenses

This commit is contained in:
Alan Orth 2021-03-11 10:36:26 +02:00
parent 3b17914002
commit 5318953150
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -336,3 +336,27 @@ def test_check_correct_iso_639_3_language():
result = experimental.correct_language(series) result = experimental.correct_language(series)
assert result == language assert result == language
def test_check_valid_spdx_license_identifier():
"""Test valid SPDX license identifier."""
license = "CC-BY-SA-4.0"
result = check.spdx_license_identifier(license)
assert result == license
def test_check_invalid_spdx_license_identifier(capsys):
"""Test invalid SPDX license identifier."""
license = "CC-BY-SA"
result = check.spdx_license_identifier(license)
captured = capsys.readouterr()
assert (
captured.out
== f"{Fore.YELLOW}Non-SPDX license identifier: {Fore.RESET}{license}\n"
)