def test_to_dict_with_range(self):
     ann = Annotation(text="Bar")
     ann.ranges.append(Range())
     assert len(ann.to_dict()['ranges']) == 1, "annotation ranges weren't in dict"
 def test_extras_out(self):
     ann = Annotation(extras='{"bar": 3, "baz": 4}')
     data = ann.to_dict()
     assert data['bar'] == 3, "extras weren't deserialized properly"
     assert data['baz'] == 4, "extras weren't deserialized properly"
 def test_to_dict(self):
     ann = Annotation(text="Foo")
     data = {'ranges': [], 'text': 'Foo', 'id': None, 'user': None}
     assert ann.to_dict() == data, "annotation wasn't converted to dict correctly"