def test_all_semvers_to_version(self): """ Check that all valid semvers validate and are converted to major.minor versions correctly """ for x in range(256): for y in range(256): self.assertEqual( version.semver_to_version("{}.{}.0".format(x, y)), "{}.{}".format(x, y))
def semver(self, value): """ Set the app's version label from a semver string. """ if self.project_type == 'package': # This throws an error if the semver is invalid. parse_semver(value) self.app_version_label = value else: self.app_version_label = semver_to_version(value)
def test_semvers_discard_patch(self): """ Check that semver_to_version() discards the patch number. """ self.assertEqual(version.semver_to_version("1.2.3"), "1.2")
def test_semvers_to_version(self): """ Check that valid x.y.0 semvers validate and are converted to major.minor versions correctly """ for x in range(256): for y in range(256): self.assertEqual(version.semver_to_version("{}.{}.0".format(x, y)), "{}.{}".format(x, y))
def run_invalid_semver_test(self, semver): with self.assertRaises(ValueError): version.semver_to_version(semver)
def semver(self, value): """ Set the app's version label from a semver string""" self.app_version_label = semver_to_version(value)