--- test_zlib.py~ 2008-04-08 19:25:17.000000000 -0500 +++ test_zlib.py 2009-08-19 16:32:17.548756094 -0500 @@ -379,6 +379,22 @@ d.flush() self.assertRaises(ValueError, d.copy) + if hasattr(zlib.decompressobj(), "is_finished"): + def test_is_finished(self): + """ + Concatenate compressed data with uncompressed data to see if + the is_finished attribute is being set correctly + """ + co = zlib.compressobj() + x1 = co.compress(HAMLET_SCENE) + x2 = co.flush() + dco = zlib.decompressobj() + y1 = dco.decompress(x1 + x2 + HAMLET_SCENE) + y2 = dco.flush() + self.assertTrue(dco.is_finished) + y3 = dco.unused_data + self.assertEqual(HAMLET_SCENE * 2, y1 + y2 + y3) + def genblock(seed, length, step=1024, generator=random): """length-byte stream of random data from a seed (in step-byte blocks).""" if seed is not None: