def test_decompress(self): gen = decompress_gen(BytesIO(self.compressed_data[2:])) self.assertEqual(self.original_data, b''.join(gen)) # print '-----' f = decompress(BytesIO(self.compressed_data[2:])) g = BytesIO(self.original_data) self.assertEqual(f.read(2048), g.read(2048)) self.assertEqual(f.read(1024), g.read(1024)) self.assertEqual(f.read(4096), g.read(4096)) self.assertEqual(f.read(), g.read())
def test_decompress(self): from StringIO import StringIO from hwp5.compressed import decompress_gen gen = decompress_gen(StringIO(self.compressed_data[2:])) self.assertEquals(self.original_data, ''.join(gen)) #print '-----' from hwp5.compressed import decompress f = decompress(StringIO(self.compressed_data[2:])) g = StringIO(self.original_data) self.assertEquals(f.read(2048), g.read(2048)) self.assertEquals(f.read(1024), g.read(1024)) self.assertEquals(f.read(4096), g.read(4096)) self.assertEquals(f.read(), g.read())
def open(self): return decompress(self.wrapped.open())