Merge pull request #3295 from radarhere/imagefilter_tests

Added ImageFilter tests
This commit is contained in:
Andrew Murray 2018-08-25 23:26:31 +10:00 committed by GitHub
commit f9ecda92da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,15 @@ class TestImageFilter(PillowTestCase):
self.assertEqual(rankfilter.size, 1)
self.assertEqual(rankfilter.rank, 2)
def test_kernel_not_enough_coefficients(self):
self.assertRaises(ValueError,
lambda: ImageFilter.Kernel((3, 3), (0, 0)))
def test_kernel_filter_p(self):
kernel = ImageFilter.Kernel((2, 2), (0, 0, 0, 0))
self.assertRaises(ValueError, kernel.filter, hopper("P"))
def test_consistency_3x3(self):
source = Image.open("Tests/images/hopper.bmp")
reference = Image.open("Tests/images/hopper_emboss.bmp")