ImageOps.box_blur is deprecated, use ImageFilter.BoxBlur instead

This commit is contained in:
Hugo 2018-04-10 17:08:32 +03:00
parent f733482c0e
commit 7e8998a452
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase
from PIL import Image, ImageOps
from PIL import Image, ImageFilter
sample = Image.new("L", (7, 5))
@ -16,7 +16,7 @@ sample.putdata(sum([
class TestBoxBlurApi(PillowTestCase):
def test_imageops_box_blur(self):
i = ImageOps.box_blur(sample, 1)
i = sample.filter(ImageFilter.BoxBlur(1))
self.assertEqual(i.mode, sample.mode)
self.assertEqual(i.size, sample.size)
self.assertIsInstance(i, Image.Image)

View File

@ -17,6 +17,11 @@ class TestImageOpsUsm(PillowTestCase):
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning,
ImageOps.box_blur, im, 1)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning,
ImageOps.gblur, im, 2.0)
self.assertEqual(i.mode, "RGB")