def test_bump_version_getver(self, mock_exists): for f in [ 'AAA.v42', 'D/C/B/AAA.v42', 'D/C.v7/B/AAAA.v42/', 'A.v42.foo', 'A.v23.bar.v42.foo', 'D/C/A.v42.foo', 'D/C/A.v23.bar.v42.foo' ]: _, ver = util.bump_version(f) self.assertEqual(ver, 42)
def test_bump_version_noexist(self, mock_exists): for f in [ 'AAA', 'AAA.v1', 'D/C/B/AAA', 'D/C/B/AAAA/', 'D/C/B/AAA.v23', 'D/C/B/AAAA.v23/', 'A.foo', 'A.v23.foo', 'A.v23.bar.v45.foo', 'D/C/A.foo', 'D/C/A.v23.foo', 'D/C/A.v23.bar.v45.foo' ]: f2, _ = util.bump_version(f) self.assertEqual(f, f2)
def test_bump_version_setver(self, mock_exists): for f in [ ('AAA','AAA.v42'), ('AAA.v1','AAA.v42'), ('D/C/B/AA','D/C/B/AA.v42'), ('D/C.v1/B/AA/','D/C.v1/B/AA.v42/'), ('D/C/B/AA.v23','D/C/B/AA.v42'), ('D/C3/B.v8/AA.v23/','D/C3/B.v8/AA.v42/'), ('A.foo','A.v42.foo'), ('A.v23.foo','A.v42.foo'), ('A.v23.bar.v45.foo','A.v23.bar.v42.foo'), ('D/C/A.foo','D/C/A.v42.foo'), ('D/C.v1/A.v23.foo','D/C.v1/A.v42.foo'), ('D/C/A.v23.bar.v45.foo','D/C/A.v23.bar.v42.foo') ]: f1, ver = util.bump_version(f[0], new_v=42) self.assertEqual(f1, f[1]) self.assertEqual(ver, 42)