mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-13 08:44:45 +03:00
Created some basic tests of getdominantcolors functionality
This commit is contained in:
parent
f7afddaf17
commit
6f3e77b617
22
Tests/test_image_getdominantcolors.py
Normal file
22
Tests/test_image_getdominantcolors.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from .helper import hopper
|
||||||
|
|
||||||
|
|
||||||
|
def test_getdominantcolors():
|
||||||
|
def getdominantcolors(mode, numcolors=None):
|
||||||
|
im = hopper(mode)
|
||||||
|
|
||||||
|
if numcolors:
|
||||||
|
colors = im.getdominantcolors(numcolors)
|
||||||
|
else:
|
||||||
|
colors = im.getdominantcolors()
|
||||||
|
return len(colors)
|
||||||
|
|
||||||
|
assert getdominantcolors("F") == 3
|
||||||
|
assert getdominantcolors("I") == 3
|
||||||
|
assert getdominantcolors("L") == 3
|
||||||
|
assert getdominantcolors("P") == 3
|
||||||
|
assert getdominantcolors("RGB") == 3
|
||||||
|
assert getdominantcolors("YCbCr") == 3
|
||||||
|
assert getdominantcolors("CMYK") == 3
|
||||||
|
assert getdominantcolors("RGBA") == 3
|
||||||
|
assert getdominantcolors("HSV") == 3
|
Loading…
Reference in New Issue
Block a user