Stack Trace
author_testimg_generated = <_ImageWrapper id=5673>
def testBooleanAnnotation(author_testimg_generated):
> _testAnnotation(author_testimg_generated,
omero.gateway.BooleanAnnotationWrapper,
TESTANN_NS, True)
test/integration/gatewaytest/test_annotation.py:161:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <_ImageWrapper id=5673>
annclass = <class 'omero.gateway.BooleanAnnotationWrapper'>
ns = 'omero.gateway.test_annotation', value = True, sameOwner = False
testOwner = None
def _testAnnotation(obj, annclass, ns, value, sameOwner=False,
testOwner=None):
gateway = obj._conn
# Make sure it doesn't yet exist
obj.removeAnnotations(ns)
assert obj.getAnnotation(ns) is None
# Create new, link and check
ann = annclass(gateway)
ann.setNs(ns)
ann.setValue(value)
if sameOwner:
obj.linkAnnotation(ann, sameOwner=True)
else:
# checks that default sameOwner=False
obj.linkAnnotation(ann)
ann = obj.getAnnotation(ns)
# Make sure the group for the annotation is the same as the original
# object. (#120)
assert ann.getDetails().getGroup() == obj.getDetails().getGroup()
tval = hasattr(value, 'val') and value.val or value
assert ann.getValue() == value, '%s != %s' % (str(ann.getValue()),
str(tval))
assert ann.getNs() == ns, '%s != %s' % (str(ann.getNs()), str(ns))
if testOwner is not None:
testOwner(obj, ann)
# test conn.countAnnotations()
counts = gateway.countAnnotations(obj.OMERO_CLASS, [obj.id])
assert counts is not None
# Timestamp and Boolean not included in counts
if annclass.OMERO_CLASS not in ["TimestampAnnotation",
"BooleanAnnotation",
# LongAnnotation is only for 'rating'
"LongAnnotation"]:
> assert counts[annclass.OMERO_CLASS] >= 1. # e.g. TagAnnotation: 1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E KeyError: None
test/integration/gatewaytest/test_annotation.py:59: KeyError