AMMICO/misinformation/test/test_display.py
Dominic Kempf f99d15cf40
Restrict the scope of facial expression recognition by thresholding likelihood (#38)
* Apply thresholding to restrict the scope of facial expression recognition

* fix test dict faces

* remove approx

* do not ignore data in subdirs

* where does test_display come from

* remove face analysis duplication

* imageai sneaked into ci

Co-authored-by: Inga Ulusoy <inga.ulusoy@uni-heidelberg.de>
2022-12-13 13:15:56 +01:00

25 строки
806 B
Python

import json
from misinformation.display import explore_analysis
from pytest import approx
def test_explore_analysis_faces():
mydict = {"IMG_2746": {"filename": "./test/data/IMG_2746.png"}}
explore_analysis(mydict, identify="faces")
with open("./test/data/example_faces.json", "r") as file:
outs = json.load(file)
for im_key in mydict.keys():
sub_dict = mydict[im_key]
for key in sub_dict.keys():
assert sub_dict[key] == outs[key]
def test_explore_analysis_objects():
mydict = {"IMG_2746": {"filename": "./test/data/IMG_2809.png"}}
explore_analysis(mydict, identify="objects")
with open("./test/data/example_analysis_objects.json", "r") as file:
outs = json.load(file)
assert str(mydict) == str(outs)