def test_00__different_packages(self): p1 = dict(name="foo", version="1.0", release="1", epoch=0, arch="x86_64") p2 = dict(name="bar", version="1.0", release="1", epoch=0, arch="x86_64") with self.assertRaises(AssertionError): RU.find_latest([p1, p2])
def test_30_w_release(self): def gen_p(e): return dict(name="foo", version="0.1", release="1", arch="x86_64", epoch=str(e)) emax = 10 ps = [gen_p(e) for e in range(emax + 1)] random.shuffle(ps) self.assertEquals(RU.find_latest(ps)["epoch"], str(emax))
def test_20_w_release(self): def gen_p(r): return dict(name="foo", version="0.1", release=str(r), arch="x86_64", epoch="(none)") rmax = 10 ps = [gen_p(r) for r in range(rmax + 1)] random.shuffle(ps) self.assertEquals(RU.find_latest(ps)["release"], str(rmax))
def test_10_w_version(self): def gen_p(v): return dict(name="foo", version=str(v), release="1", arch="x86_64", epoch="(none)") vmax = 10 ps = [gen_p(v) for v in range(vmax + 1)] random.shuffle(ps) self.assertEquals(RU.find_latest(ps)["version"], str(vmax))
def test_00__empty_packages_list(self): with self.assertRaises(AssertionError): RU.find_latest([])