def test_extras_out(self):
     ann = Annotation.from_dict({"bar": 3, "baz": 4})
     print ann
     data = ann.to_dict()
     print data
     assert data['bar'] == 3, "extras weren't deserialized properly"
     assert data['baz'] == 4, "extras weren't deserialized properly"
 def test_extras_in(self):
     ann = Annotation.from_dict({'foo':1, 'bar':2})
     ann.save()
     ann = Annotation.get(ann.id)
     extras = dict(ann.items())
     print extras
     assert 'foo' in extras.keys(), "extras weren't serialized properly"
     assert 'bar' in extras.keys(), "extras weren't serialized properly"
     assert ann['foo'] == 1, "extras weren't serialized properly"
     assert ann['bar'] == 2, "extras weren't serialized properly"
 def test_from_dict_with_range(self):
     ann = Annotation.from_dict({'ranges': [{}]})
     assert len(ann.ranges) == 1, "annotation ranges weren't updated from dict"
 def test_from_dict(self):
     ann = Annotation.from_dict({'text': 'Baz'})
     assert ann.text == "Baz", "annotation wasn't updated from dict"