Esempio n. 1
0
 def test_repr_getter_setter(self):
     from core.Index import Index
     my_type = str(uuid.uuid4())
     field = str(uuid.uuid4())
     index = Index(my_type, field)
     assert '{0}'.format(index) == '<Index {0} ({1}) : 0 values>'.format(field, my_type)
     assert index.to_dict() == {'type': my_type, 'field': field}
     index._values = ['a', 'b', 'c']
     assert '{0}'.format(index) == '<Index {0} ({1}) : 3 values>'.format(field, my_type)
     index2 = Index.from_dict(index.to_dict())
     assert index2.to_dict() == index.to_dict()