def test_section(): v = Value() v.value = 42 p = Property() p.values.append(v) s = LatestSection() s.properties.append(p) s2 = LatestSection() s2.name = "Tester" s.subsections.append(s2.sid()) print s.sid() print s2.sid()
def _rewrite_values(self, source_property, target_property): for value in source_property.values: # create new value object (embedded document) v = Value() # copy value related fields v.value = value.value v.uncertainty = value.uncertainty v.unit = value.unit v.type_name = value.dtype v.definition = value.definition v.reference = value.reference v.filename = value.filename v.encoder = value.encoder v.checksum = value.checksum # add new object to target property values collection target_property.values.append(v)
def test_value(): v = Value() v.value = 108 v.type_name = "Int" print hashlib.sha1(str(v)).hexdigest()
def test_property(): v = Value() v.value = 41 p = Property() p.values.append(v) print hashlib.sha1(str(p)).hexdigest()