def test_str(self): assert str(SemVer.parse('1')) == '1.0.0' assert str(SemVer.parse('1.2')) == '1.2.0' assert str(SemVer.parse('1.2.3')) == '1.2.3' assert str(SemVer.parse('1.2.3-pre')) == '1.2.3-pre' assert str(SemVer.parse('1.2.3+local')) == '1.2.3+local' assert str(SemVer.parse('1.2.3-pre+local')) == '1.2.3-pre+local'
def test_parse(self): version = SemVer.parse('1') self.check_version(version, 1, 0, 0, None, None) version = SemVer.parse('1.2') self.check_version(version, 1, 2, 0, None, None) version = SemVer.parse('1.2.3') self.check_version(version, 1, 2, 3, None, None) version = SemVer.parse('1.2.3-pre') self.check_version(version, 1, 2, 3, 'pre', None) version = SemVer.parse('1.2.3+local') self.check_version(version, 1, 2, 3, None, 'local') version = SemVer.parse('1.2.3-pre+local') self.check_version(version, 1, 2, 3, 'pre', 'local')
def test_str(version, expected): assert str(SemVer.parse(version)) == expected
def test_parse(version, args): check_version(SemVer.parse(version), *args)