Pillow/Tests/test_image_getpalette.py
Jon Dufresne 2c50723f14 Convert some tests to pytest style
To better follow conventional pytest style, this removes the outer
wrapper class in favor of a function for some tests. These tests were
picked as they are relatively simple and presented no barriers to a
quick port. The assert* methods are replaced with assert statements.
When necessary, a fixture is used to create a temporary directory.

This commit does not convert the entire test suite to this style as some
test classes use methods or other advanced features that are difficult
to automatically convert. The goal is to address these issues in
followup commits.

Refs #4193
2020-01-18 12:12:10 -08:00

20 lines
497 B
Python

from .helper import hopper
def test_palette():
def palette(mode):
p = hopper(mode).getpalette()
if p:
return p[:10]
return None
assert palette("1") is None
assert palette("L") is None
assert palette("I") is None
assert palette("F") is None
assert palette("P") == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
assert palette("RGB") is None
assert palette("RGBA") is None
assert palette("CMYK") is None
assert palette("YCbCr") is None