コード例 #1
0
    def test_empty_images_pixel_compare_returns_error(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = None

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        self.assertEqual(img_diff, 'One or more images are empty' )
コード例 #2
0
    def test_equal_images_pixel_compare_returns_zero(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = im1.copy()

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        self.assertEqual(img_diff, 0 )
コード例 #3
0
    def test_empty_images_pixel_compare_returns_error(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = None

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        self.assertEqual(img_diff, 'One or more images are empty')
コード例 #4
0
    def test_equal_images_pixel_compare_returns_zero(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = im1.copy()

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        self.assertEqual(img_diff, 0)
コード例 #5
0
    def test_opposite_images_pixel_compare_returns_one_hundred(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = Image.new('RGB', (256, 256), 'black')

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        print(img_diff)
        self.assertEqual(img_diff, 100.0)
コード例 #6
0
    def test_opposite_images_pixel_compare_returns_one_hundred(self):
        im1 = Image.new('RGB', (256, 256), 'white')
        im2 = Image.new('RGB', (256, 256), 'black')

        img_comp = ImageTools()
        img_diff = img_comp._compare_images_pixel(im1, im2)
        print(img_diff)
        self.assertEqual(img_diff, 100.0)