2023-12-21 14:13:31 +03:00
|
|
|
from __future__ import annotations
|
2020-01-27 14:46:52 +03:00
|
|
|
from .helper import hopper
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
2020-01-27 14:46:52 +03:00
|
|
|
def test_histogram():
|
|
|
|
def histogram(mode):
|
|
|
|
h = hopper(mode).histogram()
|
|
|
|
return len(h), min(h), max(h)
|
2014-06-10 13:10:47 +04:00
|
|
|
|
2020-01-27 14:46:52 +03:00
|
|
|
assert histogram("1") == (256, 0, 10994)
|
|
|
|
assert histogram("L") == (256, 0, 662)
|
|
|
|
assert histogram("I") == (256, 0, 662)
|
|
|
|
assert histogram("F") == (256, 0, 662)
|
2022-06-18 11:09:41 +03:00
|
|
|
assert histogram("P") == (256, 0, 1551)
|
2020-01-27 14:46:52 +03:00
|
|
|
assert histogram("RGB") == (768, 4, 675)
|
|
|
|
assert histogram("RGBA") == (1024, 0, 16384)
|
|
|
|
assert histogram("CMYK") == (1024, 0, 16384)
|
|
|
|
assert histogram("YCbCr") == (768, 0, 1908)
|