(self)
Adam7 interlace writing.
        For each test image in the PngSuite, write an interlaced
        and a straightlaced version.  Decode both, and compare results.
Adam7 interlace writing.
        For each test image in the PngSuite, write an interlaced
        and a straightlaced version.  Decode both, and compare results.
Adam7 interlace writing . For each test image in the PngSuite write an interlaced and a straightlaced version . Decode both and compare results .
def testAdam7write(self):
        """Adam7 interlace writing.
        For each test image in the PngSuite, write an interlaced
        and a straightlaced version.  Decode both, and compare results.
        """
        # Not such a great test, because the only way we can check what
        # we have written is to read it back again.

        for name,bytes in list(_pngsuite.items()):
            # Only certain colour types supported for this test.
            if name[3:5] not in ['n0', 'n2', 'n4', 'n6']:
                continue
            it = Reader(bytes=bytes)
            x,y,pixels,meta = it.read()
            pngi = topngbytes('adam7wn'+name+'.png', pixels,
              x=x, y=y, bitdepth=it.bitdepth,
              greyscale=it.greyscale, alpha=it.alpha,
              transparent=it.transparent,
              interlace=False)
            x,y,ps,meta = Reader(bytes=pngi).read()
            it = Reader(bytes=bytes)
            x,y,pixels,meta = it.read()
            pngs = topngbytes('adam7wi'+name+'.png', pixels,
              x=x, y=y, bitdepth=it.bitdepth,
              greyscale=it.greyscale, alpha=it.alpha,
              transparent=it.transparent,
              interlace=True)
            x,y,pi,meta = Reader(bytes=pngs).read()
            self.assertEqual(list(map(list, ps)), list(map(list, pi)))
def testAdam7write ( self ) : # Not such a great test, because the only way we can check what # we have written is to read it back again. for name , bytes in list ( _pngsuite . items ( ) ) : # Only certain colour types supported for this test. if name [ 3 : 5 ] not in [ 'n0' , 'n2' , 'n4' , 'n6' ] : continue it = Reader ( bytes = bytes ) x , y , pixels , meta = it . read ( ) pngi = topngbytes ( 'adam7wn' + name + '.png' , pixels , x = x , y = y , bitdepth = it . bitdepth , greyscale = it . greyscale , alpha = it . alpha , transparent = it . transparent , interlace = False ) x , y , ps , meta = Reader ( bytes = pngi ) . read ( ) it = Reader ( bytes = bytes ) x , y , pixels , meta = it . read ( ) pngs = topngbytes ( 'adam7wi' + name + '.png' , pixels , x = x , y = y , bitdepth = it . bitdepth , greyscale = it . greyscale , alpha = it . alpha , transparent = it . transparent , interlace = True ) x , y , pi , meta = Reader ( bytes = pngs ) . read ( ) self . assertEqual ( list ( map ( list , ps ) ) , list ( map ( list , pi ) ) )