def test_to_dict(self): ann = Annotation(text="Foo") data = {'ranges': [], 'text': 'Foo', 'user': {}} outdict = ann.to_dict() for k,v in data.items(): print k,v,outdict[k] assert outdict[k] == v, "annotation wasn't converted to dict correctly"
def test_to_dict_with_range(self): ann = Annotation(text="Bar") ann.ranges.append({}) assert len(ann.to_dict()['ranges']) == 1, "annotation ranges weren't in dict"