Exemple #1
0
 def test_emptychecker(self):
     cic = CompositeImage.CompositeImageCollector([])
     si1 = CompositeImage.SingleImage(file_list[0])
     cic.check(si1)  # No other way to add image to a checker
     si2 = CompositeImage.SingleImage(file_list[1])
     cic.check(si2)
     n_imgs = len(cic.getCompImage())
     self.assertEqual(2, n_imgs, 'Empty checker case')
Exemple #2
0
    def test_defaultchecker(self):
        cic = CompositeImage.CompositeImageCollector([self.false_chkr])
        si0 = CompositeImage.SingleImage(file_list[0])
        check_result = cic.check(si0)
        self.assertTrue(check_result,
                        'default checker does not return True for 1st image')
        self.assertTrue(1 == len(cic.getCompImage()),
                        'default check function error at 1st image')

        si1 = CompositeImage.SingleImage(file_list[3])
        check_result = cic.check(si1)
        self.assertFalse(
            check_result,
            'default checker does not return False for 2nd, nonmatching image')
        self.assertTrue(
            len(cic.getCompImage()) == 1,
            'default checker added the 2nd image')

        cic.setCheckers([self.true_chkr])
        check_result = cic.check(si0)
        l = len(cic.getCompImage())
        self.assertTrue(check_result,
                        'Adding the same image again, return value')
        self.assertEqual(1, l, 'Adding the same image again, amount of images')
Exemple #3
0
 def setUp(self):
     self.checker_head = CompositeImage.CompositeImageCollector()
Exemple #4
0
 def test_setNextCollector(self):
     self.cic = CompositeImage.CompositeImageCollector(self.true_chkr)
     self.cic.setNextCollector(1)
     self.assertTrue(1 == self.cic._next_collector,
                     'Failed to set successor')