mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 05:36:48 +03:00
18 lines
770 B
Python
18 lines
770 B
Python
from .helper import PillowTestCase, hopper
|
|
|
|
|
|
class TestImageEntropy(PillowTestCase):
|
|
def test_entropy(self):
|
|
def entropy(mode):
|
|
return hopper(mode).entropy()
|
|
|
|
self.assertAlmostEqual(entropy("1"), 0.9138803254693582)
|
|
self.assertAlmostEqual(entropy("L"), 7.06650513081286)
|
|
self.assertAlmostEqual(entropy("I"), 7.06650513081286)
|
|
self.assertAlmostEqual(entropy("F"), 7.06650513081286)
|
|
self.assertAlmostEqual(entropy("P"), 5.0530452472519745)
|
|
self.assertAlmostEqual(entropy("RGB"), 8.821286587714319)
|
|
self.assertAlmostEqual(entropy("RGBA"), 7.42724306524488)
|
|
self.assertAlmostEqual(entropy("CMYK"), 7.4272430652448795)
|
|
self.assertAlmostEqual(entropy("YCbCr"), 7.698360534903628)
|