Exemple #1
0
    def test_in_ids(self):
        jobs = Jobs([self.job1, self.job2, self.job3, self.job4, self.job5])

        subjobs = jobs.in_ids([1, 2, 5])
        self.assertEquals(self.job1, subjobs.get(1))
        self.assertEquals(self.job2, subjobs.get(2))
        self.assertEquals(self.job5, subjobs.get(3))
Exemple #2
0
    def test_in_ids(self):
        jobs = Jobs([self.job1, self.job2, self.job3, self.job4, self.job5])

        subjobs = jobs.in_ids([1, 2, 5])
        self.assertEquals(self.job1, subjobs.get(1))
        self.assertEquals(self.job2, subjobs.get(2))
        self.assertEquals(self.job5, subjobs.get(3))
Exemple #3
0
    def test_get(self):
        jobs = Jobs([self.job1, self.job2, self.job3, self.job4, self.job5])

        self.assertEquals(self.job1, jobs.get(1))
        self.assertEquals(self.job2, jobs.get(2))
        self.assertEquals(self.job3, jobs.get(3))
        self.assertEquals(self.job4, jobs.get(4))
        self.assertEquals(self.job5, jobs.get(5))
Exemple #4
0
    def test_remove(self):
        joblist = [self.job1, self.job2, self.job3, self.job4, self.job5]
        jobs = Jobs(joblist[:])

        #remove job1
        joblist.remove(self.job1)
        jobs.remove(self.job1)
        self.assertEquals(jobs.all(), joblist)
Exemple #5
0
    def test_get(self):
        jobs = Jobs([self.job1, self.job2, self.job3, self.job4, self.job5])

        self.assertEquals(self.job1, jobs.get(1))
        self.assertEquals(self.job2, jobs.get(2))
        self.assertEquals(self.job3, jobs.get(3))
        self.assertEquals(self.job4, jobs.get(4))
        self.assertEquals(self.job5, jobs.get(5))
Exemple #6
0
    def test_remove(self):
        joblist = [self.job1, self.job2, self.job3, self.job4, self.job5]
        jobs = Jobs(joblist[:])

        #remove job1
        joblist.remove(self.job1)
        jobs.remove(self.job1)
        self.assertEquals(jobs.all(), joblist)
Exemple #7
0
    def test_all(self):
        joblist = [
            self.job1,
            self.job2,
            self.job3,
            self.job4,
            self.job5,
            self.job6,
        ]

        jobs = Jobs(joblist)
        self.assertEquals(joblist, jobs.all())
Exemple #8
0
    def test_all(self):
        joblist = [
            self.job1,
            self.job2,
            self.job3,
            self.job4,
            self.job5,
            self.job6,
        ]

        jobs = Jobs(joblist)
        self.assertEquals(joblist, jobs.all())
Exemple #9
0
    def test_merge(self):
        jobsa = Jobs([self.job1, self.job2, self.job3])
        jobsb = Jobs([self.job4, self.job5])

        jobsa.merge(jobsb)
        self.assertEquals(self.job1, jobsa.get(1))
        self.assertEquals(self.job2, jobsa.get(2))
        self.assertEquals(self.job3, jobsa.get(3))
        self.assertEquals(self.job4, jobsa.get(4))
        self.assertEquals(self.job5, jobsa.get(5))
Exemple #10
0
    def test_iterator(self):
        joblist = [
            self.job1,
            self.job2,
            self.job3,
            self.job4,
            self.job5,
            self.job6,
        ]

        jobs = Jobs(joblist[:])
        for index, job in enumerate(jobs):
            self.assertEquals(job.line, joblist[index].line)
Exemple #11
0
    def test_add(self):
        # test jobs from constructor
        jobs = Jobs([self.job1, self.job2, self.job3])
        self.assertEquals(len(jobs), 3)

        # test add method
        jobs.add(self.job4)
        jobs.add(self.job5)
        self.assertEquals(len(jobs), 5)

        # test adding an invalid job
        with self.assertRaises(AttributeError):
            jobs.add('invalidobject')

        jobs.clear_all()
Exemple #12
0
    def test_merge(self):
        jobsa = Jobs([self.job1, self.job2, self.job3])
        jobsb = Jobs([self.job4, self.job5])

        jobsa.merge(jobsb)
        self.assertEquals(self.job1, jobsa.get(1))
        self.assertEquals(self.job2, jobsa.get(2))
        self.assertEquals(self.job3, jobsa.get(3))
        self.assertEquals(self.job4, jobsa.get(4))
        self.assertEquals(self.job5, jobsa.get(5))
Exemple #13
0
    def test_add(self):
        # test jobs from constructor
        jobs = Jobs([self.job1, self.job2, self.job3])
        self.assertEquals(len(jobs), 3)

        # test add method
        jobs.add(self.job4)
        jobs.add(self.job5)
        self.assertEquals(len(jobs), 5)

        # test adding an invalid job
        with self.assertRaises(AttributeError):
            jobs.add('invalidobject')

        jobs.clear_all()
Exemple #14
0
 def test_clear_all(self):
     jobs = Jobs([self.job1, self.job2, self.job3])
     jobs.clear_all()
     self.assertEquals(len(jobs), 0)
Exemple #15
0
 def test_clear_all(self):
     jobs = Jobs([self.job1, self.job2, self.job3])
     jobs.clear_all()
     self.assertEquals(len(jobs), 0)