def test_generation(self):
        logging.debug("Creating canvas: %d, %d", WIDTH, HEIGHT)
        c = PNGCanvas(WIDTH, HEIGHT, color=(0xff, 0, 0, 0xff))
        c.rectangle(0, 0, WIDTH - 1, HEIGHT - 1)

        logging.debug("Generating gradient...")
        c.vertical_gradient(1, 1, WIDTH - 2, HEIGHT - 2,
                            (0xff, 0, 0, 0xff), (0x20, 0, 0xff, 0x80))

        logging.debug("Drawing some lines...")
        c.color = bytearray((0, 0, 0, 0xff))
        c.line(0, 0, WIDTH - 1, HEIGHT - 1)
        c.line(0, 0, WIDTH / 2, HEIGHT - 1)
        c.line(0, 0, WIDTH - 1, HEIGHT / 2)

        logging.debug("Copy rect to self...")
        c.copy_rect(1, 1, WIDTH / 2 - 1, HEIGHT / 2 - 1, 1, HEIGHT / 2, c)

        logging.debug("Blend rect to self...")
        c.blend_rect(1, 1, WIDTH / 2 - 1, HEIGHT / 2 - 1, WIDTH / 2, 0, c)

        with io.open('reference.png', 'rb') as reference:
            with io.BytesIO() as test:
                logging.debug("Writing to file...")
                test.write(c.dump())
                test.seek(0)

                logging.debug("Comparing with the reference...")
                self.assertTrue(self.compare(reference, test))
dataset/ETHPy150Open rcarmo/pngcanvas/test_pngcanvas.py/CanvasTest.test_generation/original