(self)
Test that the command line tool can read PAM file.
Test that the command line tool can read PAM file.
Test that the command line tool can read PAM file .
def testPAMin(self):
        """Test that the command line tool can read PAM file."""
        def do():
            return _main(['testPAMin'])
        s = BytesIO()
        s.write(strtobytes('P7\nWIDTH 3\nHEIGHT 1\nDEPTH 4\nMAXVAL 255\n'
                'TUPLTYPE RGB_ALPHA\nENDHDR\n'))
        # The pixels in flat row flat pixel format
        flat =  [255,0,0,255, 0,255,0,120, 0,0,255,30]
        asbytes = seqtobytes(flat)
        s.write(asbytes)
        s.flush()
        s.seek(0)
        o = BytesIO()
        testWithIO(s, o, do)
        r = Reader(bytes=o.getvalue())
        x,y,pixels,meta = r.read()
        self.assertTrue(r.alpha)
        self.assertTrue(not r.greyscale)
        self.assertEqual(list(itertools.chain(*pixels)), flat)
def testPAMin ( self ) : def do ( ) : return _main ( [ 'testPAMin' ] ) s = BytesIO ( ) s . write ( strtobytes ( 'P7\nWIDTH 3\nHEIGHT 1\nDEPTH 4\nMAXVAL 255\n' 'TUPLTYPE RGB_ALPHA\nENDHDR\n' ) ) # The pixels in flat row flat pixel format flat = [ 255 , 0 , 0 , 255 , 0 , 255 , 0 , 120 , 0 , 0 , 255 , 30 ] asbytes = seqtobytes ( flat ) s . write ( asbytes ) s . flush ( ) s . seek ( 0 ) o = BytesIO ( ) testWithIO ( s , o , do ) r = Reader ( bytes = o . getvalue ( ) ) x , y , pixels , meta = r . read ( ) self . assertTrue ( r . alpha ) self . assertTrue ( not r . greyscale ) self . assertEqual ( list ( itertools . chain ( * pixels ) ) , flat )