def test_face_detector_no_face(self): fd.set_classifiers(c1, c2, c3) face_box = fd.detect_face(self.test_image_face) x1 = face_box.x y1 = face_box.y x2 = face_box.width + x1 y2 = face_box.height + y1 self.assertTrue(face_box is None, "Image does not contain a face!")
def test_multiple_faces(self, faces): fd.set_classifiers(c1, c2, c3) for image in faces: index = 0 face_box = fd.detect_face(image) if face_box is not None: x1 = face_box.x y1 = face_box.y x2 = face_box.width + x1 y2 = face_box.height + y1 self.assertTrue(face_box is not None, "Image %d contains a face between (%d,%d) and (%d,%d)"%(index,x1,y1,x2,y2)) else: self.assertTrue(face_box is None, "Image %d contains no face!"%s(index)) index+=1