forked from python-poetry/poetry-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy over old test cases from poetry repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from poetry.core.spdx import license_by_id | ||
|
||
|
||
def test_classifier_name(): | ||
license = license_by_id("lgpl-3.0-or-later") | ||
|
||
assert ( | ||
license.classifier_name | ||
== "GNU Lesser General Public License v3 or later (LGPLv3+)" | ||
) | ||
|
||
|
||
def test_classifier_name_no_classifer_osi_approved(): | ||
license = license_by_id("LiLiQ-R-1.1") | ||
|
||
assert license.classifier_name is None | ||
|
||
|
||
def test_classifier_name_no_classifer(): | ||
license = license_by_id("Leptonica") | ||
|
||
assert license.classifier_name == "Other/Proprietary License" | ||
|
||
|
||
def test_classifier(): | ||
license = license_by_id("lgpl-3.0-or-later") | ||
|
||
assert license.classifier == ( | ||
"License :: " | ||
"OSI Approved :: " | ||
"GNU Lesser General Public License v3 or later (LGPLv3+)" | ||
) | ||
|
||
|
||
def test_classifier_no_classifer_osi_approved(): | ||
license = license_by_id("LiLiQ-R-1.1") | ||
|
||
assert license.classifier == "License :: OSI Approved" | ||
|
||
|
||
def test_classifier_no_classifer(): | ||
license = license_by_id("Leptonica") | ||
|
||
assert license.classifier == "License :: Other/Proprietary License" | ||
|
||
|
||
def test_proprietary_license(): | ||
license = license_by_id("Proprietary") | ||
|
||
assert "License :: Other/Proprietary License" == license.classifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
|
||
from poetry.core.spdx import license_by_id | ||
|
||
|
||
def test_license_by_id(): | ||
license = license_by_id("MIT") | ||
|
||
assert license.id == "MIT" | ||
assert license.name == "MIT License" | ||
assert license.is_osi_approved | ||
assert not license.is_deprecated | ||
|
||
license = license_by_id("LGPL-3.0-or-later") | ||
|
||
assert license.id == "LGPL-3.0-or-later" | ||
assert license.name == "GNU Lesser General Public License v3.0 or later" | ||
assert license.is_osi_approved | ||
assert not license.is_deprecated | ||
|
||
|
||
def test_license_by_id_is_case_insensitive(): | ||
license = license_by_id("mit") | ||
|
||
assert license.id == "MIT" | ||
|
||
license = license_by_id("miT") | ||
|
||
assert license.id == "MIT" | ||
|
||
|
||
def test_license_by_id_with_full_name(): | ||
license = license_by_id("GNU Lesser General Public License v3.0 or later") | ||
|
||
assert license.id == "LGPL-3.0-or-later" | ||
assert license.name == "GNU Lesser General Public License v3.0 or later" | ||
assert license.is_osi_approved | ||
assert not license.is_deprecated | ||
|
||
|
||
def test_license_by_id_invalid(): | ||
with pytest.raises(ValueError): | ||
license_by_id("invalid") |