def test_repr(): filename = "test/data/medium.txt.dz" dzfile = decompressor.IdzipFile(filename) eq_(dzfile.name, filename) file_id = hex(id(dzfile)) eq_(repr(dzfile), "<idzip open file '%s' at %s>" % (filename, file_id))
def test_thrashing(f="test/data/large.txt.dz"): dzfile = decompressor.IdzipFile(f) for i in range(3000): # thrash about dzfile.seek(50) d = dzfile.read(4) # next line forces the whole chunk to decompress again, # even though it's next 4 bytes d = dzfile.read(4)
def test_thrashing(f="test/data/large.txt.dz"): dzfile = decompressor.IdzipFile(f) for i in range(3000): # thrash about dzfile.seek(50) d = dzfile.read(4) dzfile.seek(100000) d = dzfile.read(4) dzfile.seek(510000) d = dzfile.read(4) dzfile.seek(7000000) d = dzfile.read(4)
def create_data_readers(): filenames = [ "empty.txt", "medium.txt", "one_chunk.txt", "small.txt", "small_empty_medium.txt", "two_chunks.txt", "two_members.txt", ] readers = [] for filename in filenames: expected_input = open("test/data/%s" % filename, "rb") input = decompressor.IdzipFile("test/data/%s.dz" % filename) readers.append(EqReader(expected_input, input)) return readers
def _eq_decompress(filename): input = decompressor.IdzipFile("test/data/%s.dz" % filename) asserting.eq_files("test/data/%s" % filename, input)