コード例 #1
0
ファイル: init.py プロジェクト: zipdrug/poetry
    def _validate_license(self, license: str) -> str:
        from poetry.core.spdx import license_by_id

        if license:
            license_by_id(license)

        return license
コード例 #2
0
ファイル: test_main.py プロジェクト: pexip/os-poetry-core
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"
コード例 #3
0
ファイル: test_main.py プロジェクト: pexip/os-poetry-core
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
コード例 #4
0
ファイル: package.py プロジェクト: tomgrin10/core
 def license(self, value):
     if value is None:
         self._license = value
     elif isinstance(value, License):
         self._license = value
     else:
         self._license = license_by_id(value)
コード例 #5
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
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+)")
コード例 #6
0
 def license(self, value):  # type: (Optional[str, License]) -> None
     if value is None:
         self._license = value
     elif isinstance(value, License):
         self._license = value
     else:
         self._license = license_by_id(value)
コード例 #7
0
ファイル: test_main.py プロジェクト: pexip/os-poetry-core
def test_license_by_id_custom():
    license = license_by_id("Custom")

    assert license.id == "Custom"
    assert license.name == "Custom"
    assert not license.is_osi_approved
    assert not license.is_deprecated
コード例 #8
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
def test_custom_license():
    license = license_by_id("Amazon Software License")

    assert "License :: Other/Proprietary License" == license.classifier
コード例 #9
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
def test_proprietary_license():
    license = license_by_id("Proprietary")

    assert "License :: Other/Proprietary License" == license.classifier
コード例 #10
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
def test_classifier_no_classifer():
    license = license_by_id("Leptonica")

    assert license.classifier == "License :: Other/Proprietary License"
コード例 #11
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
def test_classifier_no_classifer_osi_approved():
    license = license_by_id("LiLiQ-R-1.1")

    assert license.classifier == "License :: OSI Approved"
コード例 #12
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
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+)")
コード例 #13
0
ファイル: test_license.py プロジェクト: pexip/os-poetry-core
def test_classifier_name_no_classifer_osi_approved():
    license = license_by_id("LiLiQ-R-1.1")

    assert license.classifier_name is None
コード例 #14
0
ファイル: test_main.py プロジェクト: pexip/os-poetry-core
def test_license_by_id_invalid():
    with pytest.raises(ValueError):
        license_by_id("")