Exemple #1
0
def test_transform_to_semver_failure():
    results = []
    for semver in test_npm_semver_ranges:
        try:
            utils.transform_to_semver(semver)
            assert False, 'test_transform_to_semver_failure0 did not raise exception!'
        except ValueError as msg:
            assert ((str(msg) == 'Version ranges seems to already be semver')
                    or (str(msg)
                        == 'Recommended Version is currently not supported.'))
Exemple #2
0
def to_semver(spec: str) -> str:
    """
    Convert unified range string to semver string.
    :param spec: str
    :return: semver
    """
    semver = utils.transform_to_semver(spec)
    return semver
Exemple #3
0
def test_transform_to_semver():
    results = []
    # using the expected results of npm to check the full conversion.
    for unified in expected_version_range:
        results.append(utils.transform_to_semver(unified))
    assert (expected_npm_semver_range == list(map(str, results)))