예제 #1
0
 def _write_index(self, fp, index):
     index_offset = fp.tell()
     compressed = compress(dumps(index))
     write_int8_str(fp, compressed)
     fp.seek(len(self.MAGIC))
     write_int8(fp, index_offset)
     assert fp.tell() == len(self.MAGIC) + 8
예제 #2
0
파일: utest_utils.py 프로젝트: cfobel/durus
 def e(self):
     s = BytesIO()
     durus.utils.TRACE = True
     for x in ('', 'a', 'ab', 'a' * 1000):
         x = as_bytes(x)
         s.seek(0)
         write_int8_str(s, x)
         s.seek(0)
         assert x == read_int8_str(s)
     durus.utils.TRACE = False