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.'))
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
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)))