def test_addJob2(self): jc = SimpleJobContainer(incrementID=True) for j in self.jobs0: jc.addJob(j) ref_ids = set(self.ref_increment_ids) ids = set(jc.jobs.keys()) self.assertEqual(ref_ids, ids)
def test_start5(self): jc = SimpleJobContainer(incrementID=True) for j in self.jobs4: jc.addJob(j) jc.start() exc = jc.close() res = [jc.getJobResult(jid) for jid in self.ref_increment_ids] ref_res = [[i * i for i in range(10) if i % 2 == 1] for _ in range(10)] self.assertEqual(ref_res, res) self.assertEqual([], exc) jc.clear()
def test_start3(self): jc = SimpleJobContainer(incrementID=True) for j in self.jobs2: jc.addJob(j) jc.start() exc = jc.close() res = [jc.getJobResult(jid) for jid in self.ref_increment_ids] ref_res = set([10]) self.assertEqual(ref_res, set(res)) self.assertEqual([], exc) jc.clear()
def test_start1(self): jc = SimpleJobContainer(incrementID=True) for j in self.jobs0: jc.addJob(j) jc.start() exc = jc.close() res = [jc.getJobResult(jid) for jid in self.ref_increment_ids] for r in res: self.assertIsNone(r) for ref_jid, (jid, ex) in zip(self.ref_increment_ids, exc): self.assertEqual(ref_jid, jid) self.assertIsInstance(ex, Error) jc.clear()
def test_addJob1(self): jc = SimpleJobContainer(incrementID=False) for j in self.jobs0: jc.addJob(j) self.assertTrue( all([re.match("[0-9a-f]{16}", k) for k in jc.jobs.keys()]))
def test_init1(self): sjc1 = SimpleJobContainer() self.assertEqual([], sjc1.joblist) self.assertEqual({}, sjc1.jobs)