AMMICO/ammico/test/test_faces.py
GwydionJon 44e5a987b1
Improve documentation (#89)
* updated documentation in cropposts

* updated documentation in display

* updated documentation in faces

* added comments to objects.py

* updated utils.py docs

* updated text.py docs

* improve doc display

* fix doc for display and remove redundant variable

* removed documentation from cropposts.py

* removed unused imports

* get rid of ipywidgets dependency

* remove unused imports, improve type hints

* improve doc in utils

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Inga Ulusoy <inga.ulusoy@uni-heidelberg.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-14 22:17:20 +02:00

25 строки
692 B
Python

import ammico.faces as fc
import json
def test_set_keys():
ed = fc.EmotionDetector({})
assert ed.subdict["face"] == "No"
assert ed.subdict["multiple_faces"] == "No"
assert ed.subdict["wears_mask"] == ["No"]
assert ed.subdict["emotion"] == [None]
def test_analyse_faces(get_path):
mydict = {
"filename": get_path + "IMG_2746.png",
}
mydict.update(fc.EmotionDetector(mydict).analyse_image())
with open(get_path + "example_faces.json", "r") as file:
out_dict = json.load(file)
# delete the filename key
mydict.pop("filename", None)
for key in mydict.keys():
assert mydict[key] == out_dict[key]