diff --git a/bob/bio/base/test/dummy/annotator.py b/bob/bio/base/test/dummy/annotator.py index 0a780fee2efa661b0097269bd67e29f04a907d05..7d1a968b189b3d0c680b59f0b878f7ff2fceda1e 100644 --- a/bob/bio/base/test/dummy/annotator.py +++ b/bob/bio/base/test/dummy/annotator.py @@ -2,16 +2,18 @@ from random import random from bob.bio.base.annotator import FailSafe, Callable +def simple_annotator(image, **kwargs): + return { + 'topleft': (0, 0), + 'bottomright': image.shape, + } + + def moody_annotator(image, **kwargs): + annot = simple_annotator(image, **kwargs) if random() < 0.5: - return { - 'topleft': (0, 0), - } - else: - return { - 'topleft': (0, 0), - 'bottomright': image.shape, - } + del annot['bottomright'] + return annot def fail_annotator(image, **kwargs): @@ -20,6 +22,6 @@ def fail_annotator(image, **kwargs): annotator = FailSafe( [Callable(fail_annotator), - Callable(moody_annotator)], + Callable(simple_annotator)], required_keys=['topleft', 'bottomright'], )