def assertQualityReply(qualityDict: dict): """ Validate quality reply Args: qualityDict: quality estimation result """ assert ( jsonValidator(schema=QUALITY_SCHEMA).validate(qualityDict) is None), f"{qualityDict} does not match with schema {QUALITY_SCHEMA}"
def test_livenessv1_as_dict(self): """ Test liveness estimations as dict """ livenessDict = self.livenessEstimator.estimate(self.detection).asDict() assert ( jsonValidator(schema=LIVENESSV1_SCHEMA).validate(livenessDict) is None ), f"{livenessDict} does not match with schema {LIVENESSV1_SCHEMA}"
def test_estimate_glasses_as_dict(self): """ Test glasses estimations as dict """ glassesDict = TestGlasses.glassesEstimator.estimate( self.warpNoGlasses).asDict() assert ( jsonValidator(schema=GLASSES_SCHEMA).validate(glassesDict) is None), f"{glassesDict} does not match with schema {GLASSES_SCHEMA}"
def test_estimate_credibility_as_dict(self): """ Test credibility credibility as dict """ credibilityCheck = TestCredibility.credibilityEstimator.estimate( self.warp).asDict() assert ( jsonValidator(schema=CREDIBILITY_SCHEMA).validate(credibilityCheck) is None ), f"{credibilityCheck} does not match with schema {CREDIBILITY_SCHEMA}"
def test_bounding_box_as_dict(self): """ Test conversion bounding box to dictionary """ boundingBox = TestFaceDetector.defaultDetector.detectOne( image=VLIMAGE_ONE_FACE).boundingBox.asDict() assert ( jsonValidator(schema=REQUIRED_FACE_DETECTION).validate(boundingBox) is None ), f"{boundingBox} does not match with schema {REQUIRED_FACE_DETECTION}"
def test_landmarks_as_dict(self): """ Test conversion landmarks to dictionary """ currentLandmarks5 = TestFaceDetector.defaultDetector.detectOne( image=VLIMAGE_ONE_FACE).landmarks5.asDict() assert ( jsonValidator(schema=LANDMARKS5).validate(currentLandmarks5) is None ), f"{currentLandmarks5} does not match with schema {LANDMARKS5}"
def test_human_detection_as_dict(self): """ Test conversion result human detection to dictionary """ for case in self.landmarksCases: with self.subTest(landmarks5=case.detectLandmarks): detectAsDict = self.detector.detectOne( image=VLIMAGE_ONE_FACE, detectLandmarks=case.detectLandmarks).asDict() assert ( jsonValidator(schema=REQUIRED_HUMAN_BODY_DETECTION ).validate(detectAsDict) is None ), f"{detectAsDict} does not match with schema {REQUIRED_HUMAN_BODY_DETECTION}"
def test_face_detection_as_dict(self): """ Test conversion result face detection to dictionary """ for case in self.landmarksCases: with self.subTest(landmarks5=case.detect5Landmarks, landmarks68=case.detect68Landmarks): detectAsDict = TestFaceDetector.defaultDetector.detectOne( image=VLIMAGE_ONE_FACE, detect5Landmarks=case.detect5Landmarks, detect68Landmarks=case.detect68Landmarks, ).asDict() assert ( jsonValidator( schema=REQUIRED_FACE_DETECTION).validate(detectAsDict) is None ), f"{detectAsDict} does not match with schema {REQUIRED_FACE_DETECTION}"