Exemple #1
0
 def read_element(self):
     name = self.read_string()
     length = self.read_uint32()
     holes = []
     for i in range(length):
         holes.append(self.read_hole())
     return document.element(name, holes)
Exemple #2
0
def test():
    import zlib
    root = document.element('root', [
        document.star([
            'huh',
        ])
    ])
    pre = len(root)
    s = save_to_string(root)
    print "string length=%i, compressed=%i" % (len(s), len(zlib.compress(s)))
    root = load_from_string(s)
    assert len(root) == pre
    assert root.name == 'root'
    assert root.holes[0].a == ['huh']