mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
4a4b90c365
* autotyping: --none-return * autotyping: --scalar-return * autotyping: --int-param * autotyping: --float-param * autotyping: --str-param * autotyping: --annotate-named-param tmp_path:pathlib.Path
28 lines
809 B
Python
28 lines
809 B
Python
from __future__ import annotations
|
|
|
|
from PIL import Image
|
|
|
|
from .helper import hopper
|
|
|
|
|
|
def test_extrema() -> None:
|
|
def extrema(mode):
|
|
return hopper(mode).getextrema()
|
|
|
|
assert extrema("1") == (0, 255)
|
|
assert extrema("L") == (1, 255)
|
|
assert extrema("I") == (1, 255)
|
|
assert extrema("F") == (1, 255)
|
|
assert extrema("P") == (0, 225) # fixed palette
|
|
assert extrema("RGB") == ((0, 255), (0, 255), (0, 255))
|
|
assert extrema("RGBA") == ((0, 255), (0, 255), (0, 255), (255, 255))
|
|
assert extrema("CMYK") == ((0, 255), (0, 255), (0, 255), (0, 0))
|
|
assert extrema("I;16") == (1, 255)
|
|
|
|
|
|
def test_true_16() -> None:
|
|
with Image.open("Tests/images/16_bit_noise.tif") as im:
|
|
assert im.mode == "I;16"
|
|
extrema = im.getextrema()
|
|
assert extrema == (106, 285)
|