File: test_image_histogram.py

package info (click to toggle)
pillow 8.1.2%2Bdfsg-0.3%2Bdeb11u2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 65,628 kB
  • sloc: python: 35,630; ansic: 31,009; makefile: 388; javascript: 114; sh: 77
file content (17 lines) | stat: -rw-r--r-- 561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from .helper import hopper


def test_histogram():
    def histogram(mode):
        h = hopper(mode).histogram()
        return len(h), min(h), max(h)

    assert histogram("1") == (256, 0, 10994)
    assert histogram("L") == (256, 0, 662)
    assert histogram("I") == (256, 0, 662)
    assert histogram("F") == (256, 0, 662)
    assert histogram("P") == (256, 0, 1871)
    assert histogram("RGB") == (768, 4, 675)
    assert histogram("RGBA") == (1024, 0, 16384)
    assert histogram("CMYK") == (1024, 0, 16384)
    assert histogram("YCbCr") == (768, 0, 1908)