Ejemplo n.º 1
0
 def _do_decompress_test(self, buffer_size, **kwargs):
     unused = read_zlib_chunks(self.read, self.unpacked,
                               buffer_size=buffer_size, **kwargs)
     self.assertEqual(self.decomp, ''.join(self.unpacked.decomp_chunks))
     self.assertEqual(zlib.crc32(self.comp), self.unpacked.crc32)
     self.assertNotEquals('', unused)
     self.assertEqual(self.extra, unused + self.read())
Ejemplo n.º 2
0
 def _do_decompress_test(self, buffer_size):
     decomp, comp_len, unused_data = read_zlib_chunks(
       self.read, len(self.decomp), buffer_size=buffer_size)
     self.assertEquals(self.decomp, ''.join(decomp))
     self.assertEquals(len(self.comp), comp_len)
     self.assertNotEquals('', unused_data)
     self.assertEquals(self.extra, unused_data + self.read())
Ejemplo n.º 3
0
 def _do_decompress_test(self, buffer_size, **kwargs):
     unused = read_zlib_chunks(self.read, self.unpacked,
                               buffer_size=buffer_size, **kwargs)
     self.assertEqual(self.decomp, ''.join(self.unpacked.decomp_chunks))
     self.assertEqual(zlib.crc32(self.comp), self.unpacked.crc32)
     self.assertNotEqual('', unused)
     self.assertEqual(self.extra, unused + self.read())
Ejemplo n.º 4
0
 def test_decompress_empty(self):
     comp = zlib.compress("")
     read = StringIO(comp + self.extra).read
     decomp, comp_len, unused_data = read_zlib_chunks(read, 0)
     self.assertEqual("", "".join(decomp))
     self.assertEqual(len(comp), comp_len)
     self.assertNotEquals("", unused_data)
     self.assertEquals(self.extra, unused_data + read())
Ejemplo n.º 5
0
 def test_decompress_empty(self):
     unpacked = UnpackedObject(Tree.type_num, None, 0, None)
     comp = zlib.compress('')
     read = BytesIO(comp + self.extra).read
     unused = read_zlib_chunks(read, unpacked)
     self.assertEqual('', ''.join(unpacked.decomp_chunks))
     self.assertNotEquals('', unused)
     self.assertEqual(self.extra, unused + read())
Ejemplo n.º 6
0
 def test_decompress_empty(self):
     unpacked = UnpackedObject(Tree.type_num, None, 0, None)
     comp = zlib.compress('')
     read = BytesIO(comp + self.extra).read
     unused = read_zlib_chunks(read, unpacked)
     self.assertEqual('', ''.join(unpacked.decomp_chunks))
     self.assertNotEqual('', unused)
     self.assertEqual(self.extra, unused + read())
Ejemplo n.º 7
0
 def test_decompress_no_crc32(self):
     self.unpacked.crc32 = None
     read_zlib_chunks(self.read, self.unpacked)
     self.assertEqual(None, self.unpacked.crc32)
Ejemplo n.º 8
0
 def test_decompress_no_crc32(self):
     self.unpacked.crc32 = None
     read_zlib_chunks(self.read, self.unpacked)
     self.assertEqual(None, self.unpacked.crc32)