def ar(s): try: SemVer.clean(s) except ValueError: pass else: self.fail("ValueError not raised: '%s'" % s)
def test_clean(self): for s1, s2 in [ ('1.2.2', '1.2.2'), ('01.2.2', '1.2.2'), ('1.02.2', '1.2.2'), ('1.2.02', '1.2.2'), ('1.2.02b', '1.2.2b'), ('1.2.02beta-3 ', '1.2.2beta-3'), ('1.02.02rc1', '1.2.2rc1'), ('1.0', '1.0.0'), ('1', '1.0.0'), ('.0.02', '0.0.2'), ('1..02', '1.0.2'), ('1..', '1.0.0'), ('1.1', '1.1.0'), ('1.2.b1', '1.2.0b1'), ('9.0beta4', '9.0.0beta4'), # PostgreSQL format. ('9b', '9.0.0b'), ('rc1', '0.0.0rc1'), ('', '0.0.0'), ('..2', '0.0.2'), ('1.2.3 a', '1.2.3a'), ('..2 b', '0.0.2b'), (' 012.2.2', '12.2.2'), ('20110204', '20110204.0.0'), ]: self.assertEqual(SemVer.clean(s1), SemVer(s2))
def test_clean(self): for s1, s2 in [ ('1.2.2', '1.2.2'), ('01.2.2', '1.2.2'), ('1.02.2', '1.2.2'), ('1.2.02', '1.2.2'), ('1.2.02b', '1.2.2-b'), ('1.2.02beta-3 ', '1.2.2-beta-3'), ('1.02.02rc1', '1.2.2-rc1'), ('1.0', '1.0.0'), ('1', '1.0.0'), ('.0.02', '0.0.2'), ('1..02', '1.0.2'), ('1..', '1.0.0'), ('1.1', '1.1.0'), ('1.2.b1', '1.2.0-b1'), ('9.0beta4', '9.0.0-beta4'), # PostgreSQL format. ('9b', '9.0.0-b'), ('rc1', '0.0.0-rc1'), ('', '0.0.0'), ('..2', '0.0.2'), ('1.2.3 a', '1.2.3-a'), ('..2 b', '0.0.2-b'), (' 012.2.2', '12.2.2'), ('20110204', '20110204.0.0'), ]: try: self.assertEqual(SemVer.clean(s1), SemVer(s2)) except Exception: print(s1, s2) raise