mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
4de5477b61
With the introduction and use of pytest, it is simple and easy to execute specific tests in isolation through documented command line arguments. Either by specifying the module path or through the `-k EXPRESSION` argument. There is no longer any need to provide the boilerplate: if __name__ == '__main__': unittest.main() To every test file. It is simply noise. The pattern remains in test files that aren't named with `test_*` as those files are not discovered and executed by pytest by default.
21 lines
758 B
Python
21 lines
758 B
Python
from .helper import PillowTestCase, hopper
|
|
|
|
|
|
class TestImageHistogram(PillowTestCase):
|
|
|
|
def test_histogram(self):
|
|
|
|
def histogram(mode):
|
|
h = hopper(mode).histogram()
|
|
return len(h), min(h), max(h)
|
|
|
|
self.assertEqual(histogram("1"), (256, 0, 10994))
|
|
self.assertEqual(histogram("L"), (256, 0, 638))
|
|
self.assertEqual(histogram("I"), (256, 0, 638))
|
|
self.assertEqual(histogram("F"), (256, 0, 638))
|
|
self.assertEqual(histogram("P"), (256, 0, 1871))
|
|
self.assertEqual(histogram("RGB"), (768, 4, 675))
|
|
self.assertEqual(histogram("RGBA"), (1024, 0, 16384))
|
|
self.assertEqual(histogram("CMYK"), (1024, 0, 16384))
|
|
self.assertEqual(histogram("YCbCr"), (768, 0, 1908))
|