Stack Trace
gatewaywrapper = <omero.gateway.pytest_fixtures.GatewayWrapper object at 0x7f46e7c60a50>
def testSameOwner(gatewaywrapper):
"""
tests project.linkAnnotation(sameOwner=False)
Tests sameOwner default is False (was True for 4.4.x but False in 5.0)
"""
gatewaywrapper.loginAsAdmin()
gatewaywrapper.gateway.SERVICE_OPTS.setOmeroGroup("-1")
p = gatewaywrapper.getTestProject2()
p.getDetails().owner.id.val
def sameOwner(obj, ann):
assert obj.getDetails().owner.id.val == ann.getDetails().owner.id.val
def differentOwner(obj, ann):
assert obj.getDetails().owner.id.val != ann.getDetails().owner.id.val
> _testAnnotation(p,
omero.gateway.CommentAnnotationWrapper,
TESTANN_NS, 'some value',
sameOwner=True, testOwner=sameOwner)
test/integration/gatewaytest/test_annotation.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = <_ProjectWrapper id=487>
annclass = <class 'omero.gateway.CommentAnnotationWrapper'>
ns = 'omero.gateway.test_annotation', value = 'some value', sameOwner = True
testOwner = <function testSameOwner.<locals>.sameOwner at 0x7f46fd0016c0>
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