def test_str(self): self.assertEqual(str(Version(1, 0, 0)), '1.0.0') self.assertEqual(str(Version(1, 0)), '1.0.0') self.assertEqual(str(Version(1)), '1.0.0') self.assertEqual(str(Version.parse('1')), '1.0.0') self.assertEqual(str(Version.parse('1-foo')), '1.0.0-foo') self.assertEqual(str(Version.parse('1+foo')), '1.0.0+foo') self.assertEqual(str(Version.parse('1-foo+bar.baz')), '1.0.0-foo+bar.baz')
def test_parse_semver2_v1(self): v1 = Version.parse('1.0.0') self.assertEqual(v1.major, 1) self.assertEqual(v1.minor, 0) self.assertEqual(v1.patch, 0) self.assertEqual(v1.prerelease, None) self.assertEqual(v1.build_metadata, None)
def test_parse_semver2_v1_dev_foo_bar(self): v1 = Version.parse('1.0.0-dev+foo.bar') self.assertEqual(v1.major, 1) self.assertEqual(v1.minor, 0) self.assertEqual(v1.patch, 0) self.assertEqual(v1.prerelease, 'dev') self.assertEqual(v1.build_metadata, 'foo.bar')