Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 680350

Summary: dev-python/pillow-5.4.1: fails TestImageGetExtrema.test_extrema, TestFileWebpAnimation.test_write_animation_L
Product: Gentoo Linux Reporter: ernsteiswuerfel <erhard_f>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED OBSOLETE    
Severity: normal CC: python
Priority: Normal Keywords: TESTFAILURE
Version: unspecified   
Hardware: PPC   
OS: Linux   
URL: https://github.com/python-pillow/Pillow/issues/3927
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
emerge --info

Description ernsteiswuerfel archtester 2019-03-14 18:07:13 UTC
Created attachment 569102 [details]
build.log

=============================================== FAILURES ===============================================
___________________________________ TestImageGetExtrema.test_extrema ___________________________________

self = <test_image_getextrema.TestImageGetExtrema testMethod=test_extrema>

    def test_extrema(self):
    
        def extrema(mode):
            return hopper(mode).getextrema()
    
        self.assertEqual(extrema("1"), (0, 255))
        self.assertEqual(extrema("L"), (0, 255))
        self.assertEqual(extrema("I"), (0, 255))
        self.assertEqual(extrema("F"), (0, 255))
        self.assertEqual(extrema("P"), (0, 225))  # fixed palette
        self.assertEqual(
            extrema("RGB"), ((0, 255), (0, 255), (0, 255)))
        self.assertEqual(
            extrema("RGBA"), ((0, 255), (0, 255), (0, 255), (255, 255)))
        self.assertEqual(
            extrema("CMYK"), ((0, 255), (0, 255), (0, 255), (0, 0)))
>       self.assertEqual(extrema("I;16"), (0, 255))
E       AssertionError: Tuples differ: (0, 65280) != (0, 255)
E       
E       First differing element 1:
E       65280
E       255
E       
E       - (0, 65280)
E       + (0, 255)

Tests/test_image_getextrema.py:23: AssertionError
========================== 1 failed, 657 passed, 69 skipped in 31.87 seconds ===========================
Comment 1 ernsteiswuerfel archtester 2019-03-14 18:07:46 UTC
Created attachment 569104 [details]
emerge --info
Comment 2 ernsteiswuerfel archtester 2019-03-14 19:47:17 UTC
=============================================== FAILURES ===============================================
_____________________________ TestFileWebpAnimation.test_write_animation_L _____________________________

self = <test_file_webp_animated.TestFileWebpAnimation testMethod=test_write_animation_L>

    def test_write_animation_L(self):
        """
            Convert an animated GIF to animated WebP, then compare the
            frame count, and first and last frames to ensure they're
            visually similar.
            """
    
        orig = Image.open("Tests/images/iss634.gif")
        self.assertGreater(orig.n_frames, 1)
    
        temp_file = self.tempfile("temp.webp")
        orig.save(temp_file, save_all=True)
        im = Image.open(temp_file)
        self.assertEqual(im.n_frames, orig.n_frames)
    
        # Compare first and last frames to the original animated GIF
        orig.load()
        im.load()
        self.assert_image_similar(im, orig.convert("RGBA"), 25.0)
        orig.seek(orig.n_frames-1)
        im.seek(im.n_frames-1)
        orig.load()
        im.load()
>       self.assert_image_similar(im, orig.convert("RGBA"), 25.0)

Tests/test_file_webp_animated.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_file_webp_animated.TestFileWebpAnimation testMethod=test_write_animation_L>
a = <PIL.WebPImagePlugin.WebPImageFile image mode=RGBA size=245x245 at 0xF42A6370>
b = <PIL.Image.Image image mode=RGBA size=245x245 at 0xF428FFB0>, epsilon = 25.0, msg = None

    def assert_image_similar(self, a, b, epsilon, msg=None):
        epsilon = float(epsilon)
        self.assertEqual(
            a.mode, b.mode,
            msg or "got mode %r, expected %r" % (a.mode, b.mode))
        self.assertEqual(
            a.size, b.size,
            msg or "got size %r, expected %r" % (a.size, b.size))
    
        a, b = convert_to_comparable(a, b)
    
        diff = 0
        for ach, bch in zip(a.split(), b.split()):
            chdiff = ImageMath.eval("abs(a - b)", a=ach, b=bch).convert('L')
            diff += sum(i * num for i, num in enumerate(chdiff.histogram()))
    
        ave_diff = float(diff)/(a.size[0]*a.size[1])
        try:
            self.assertGreaterEqual(
                epsilon, ave_diff,
                (msg or '') +
                " average pixel value difference %.4f > epsilon %.4f" % (
                    ave_diff, epsilon))
        except Exception as e:
            if HAS_UPLOADER:
                try:
                    url = test_image_results.upload(a, b)
                    logger.error("Url for test images: %s" % url)
                except Exception:
                    pass
>           raise e
E           AssertionError:  average pixel value difference 57.5169 > epsilon 25.0000

Tests/helper.py:154: AssertionError
Comment 3 David Seifert gentoo-dev 2020-01-26 14:46:03 UTC
Reopen if this persists on 6