def expect(args, needles, negneedles):
            buf = StringIO.StringIO()
            opts = make_json.parse_args(args)
            make_json.main(self.db, opts, buf)
            result = buf.getvalue()

            # validate that output is newline-delimited JSON
            for line in result.split('\n'):
                if line.strip():
                    json.loads(line)

            # test for expected patterns / expected missing patterns
            for needle in needles:
                self.assertIn(needle, result)
            for needle in negneedles:
                self.assertNotIn(needle, result)
Пример #2
0
        def expect(args, needles, negneedles):
            buf = StringIO.StringIO()
            opts = make_json.parse_args(args)
            make_json.main(self.db, opts, buf)
            result = buf.getvalue()

            # validate that output is newline-delimited JSON
            for line in result.split('\n'):
                if line.strip():
                    json.loads(line)

            # test for expected patterns / expected missing patterns
            for needle in needles:
                self.assertIn(needle, result)
            for needle in negneedles:
                self.assertNotIn(needle, result)
Пример #3
0
        def expect(args, needles, negneedles, expected_ret=None):
            buf = StringIO.StringIO()
            opts = make_json.parse_args(args)
            ret = make_json.main(self.db, opts, buf)
            result = buf.getvalue()

            if expected_ret is not None:
                self.assertEqual(ret, expected_ret)

            # validate that output is newline-delimited JSON
            for line in result.split('\n'):
                if line.strip():
                    json.loads(line)

            # test for expected patterns / expected missing patterns
            for needle in needles:
                self.assertIn(needle, result)
            for needle in negneedles:
                # Only match negative needles in the middle of a word, to avoid
                # failures on timestamps that happen to contain a short number.
                self.assertNotRegexpMatches(result, r'\b%s\b' % needle)  # pylint: disable=deprecated-method
Пример #4
0
        def expect(args, needles, negneedles, expected_ret=None):
            buf = StringIO.StringIO()
            opts = make_json.parse_args(args)
            ret = make_json.main(self.db, opts, buf)
            result = buf.getvalue()

            if expected_ret is not None:
                self.assertEqual(ret, expected_ret)

            # validate that output is newline-delimited JSON
            for line in result.split('\n'):
                if line.strip():
                    json.loads(line)

            # test for expected patterns / expected missing patterns
            for needle in needles:
                self.assertIn(needle, result)
            for needle in negneedles:
                # Only match negative needles in the middle of a word, to avoid
                # failures on timestamps that happen to contain a short number.
                self.assertNotRegexpMatches(result, r'\b%s\b' % needle)
Пример #5
0
def process_image(image_path):
    """Processes the provided image getting faces and information and returns them as array"""
    face_array = fc.main(image_path)
    emotion_array = ge.main(face_array)
    age_array, gender_array = ag.get_age_gender_from_image_array(face_array)
    return make_json.main(face_array, emotion_array, age_array, gender_array)