def test_parse_semver_with_prefix(self, *mocks): """Ensure a basic semver with a prefix is parsed""" version = Version.parse("TestModule/0.0.1") self.assertEquals( Version(major=0, minor=0, patch=1, prefix="TestModule/"), version) self.assertEquals("TestModule/0.0.1", str(version))
def test_parse_untagged(self, *mocks): """Ensure an untagged version can be parsed""" version_s = "66cf7c2-HEAD" version = Version.parse(version_s) self.assertEquals( Version(major=None, minor=None, patch=None, prerelease=version_s), version, ) self.assertEquals(version_s, str(version))
def test_parse_git(self, *mocks): """parsing a version that's not an exact tag""" version = Version.parse("TestModule/0.0.1-16-g5befeb2") self.assertEquals( "16-g5befeb2", version.prerelease, ) self.assertEquals( Version( major=0, minor=0, patch=1, prefix="TestModule/", prerelease_separator="-", prerelease="16-g5befeb2", ), version, )
def test_parse_semver(self, *mocks): """Ensure a basic semver is parsed""" version = Version.parse("0.0.1") self.assertEquals(Version(major=0, minor=0, patch=1), version)