mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #2961 from radarhere/assert
Changed assert statements to unittest calls
This commit is contained in:
commit
d04380afb6
|
@ -119,7 +119,7 @@ class TestFileJpeg(PillowTestCase):
|
||||||
# using a 4-byte test code should allow us to detect out of
|
# using a 4-byte test code should allow us to detect out of
|
||||||
# order issues.
|
# order issues.
|
||||||
icc_profile = (b"Test"*int(n/4+1))[:n]
|
icc_profile = (b"Test"*int(n/4+1))[:n]
|
||||||
assert len(icc_profile) == n # sanity
|
self.assertEqual(len(icc_profile), n) # sanity
|
||||||
im1 = self.roundtrip(hopper(), icc_profile=icc_profile)
|
im1 = self.roundtrip(hopper(), icc_profile=icc_profile)
|
||||||
self.assertEqual(im1.info.get("icc_profile"), icc_profile or None)
|
self.assertEqual(im1.info.get("icc_profile"), icc_profile or None)
|
||||||
test(0)
|
test(0)
|
||||||
|
|
|
@ -27,14 +27,14 @@ class TestImageQuantize(PillowTestCase):
|
||||||
raise
|
raise
|
||||||
self.assert_image(converted, 'P', converted.size)
|
self.assert_image(converted, 'P', converted.size)
|
||||||
self.assert_image_similar(converted.convert('RGB'), image, 15)
|
self.assert_image_similar(converted.convert('RGB'), image, 15)
|
||||||
assert len(converted.getcolors()) == 100
|
self.assertEqual(len(converted.getcolors()), 100)
|
||||||
|
|
||||||
def test_octree_quantize(self):
|
def test_octree_quantize(self):
|
||||||
image = hopper()
|
image = hopper()
|
||||||
converted = image.quantize(100, Image.FASTOCTREE)
|
converted = image.quantize(100, Image.FASTOCTREE)
|
||||||
self.assert_image(converted, 'P', converted.size)
|
self.assert_image(converted, 'P', converted.size)
|
||||||
self.assert_image_similar(converted.convert('RGB'), image, 20)
|
self.assert_image_similar(converted.convert('RGB'), image, 20)
|
||||||
assert len(converted.getcolors()) == 100
|
self.assertEqual(len(converted.getcolors()), 100)
|
||||||
|
|
||||||
def test_rgba_quantize(self):
|
def test_rgba_quantize(self):
|
||||||
image = hopper('RGBA')
|
image = hopper('RGBA')
|
||||||
|
|
|
@ -422,7 +422,7 @@ class CoreResampleBoxTest(PillowTestCase):
|
||||||
|
|
||||||
def test_tiles(self):
|
def test_tiles(self):
|
||||||
im = Image.open("Tests/images/flower.jpg")
|
im = Image.open("Tests/images/flower.jpg")
|
||||||
assert im.size == (480, 360)
|
self.assertEqual(im.size, (480, 360))
|
||||||
dst_size = (251, 188)
|
dst_size = (251, 188)
|
||||||
reference = im.resize(dst_size, Image.BICUBIC)
|
reference = im.resize(dst_size, Image.BICUBIC)
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class CoreResampleBoxTest(PillowTestCase):
|
||||||
# This test shows advantages of the subpixel resizing
|
# This test shows advantages of the subpixel resizing
|
||||||
# after supersampling (e.g. during JPEG decoding).
|
# after supersampling (e.g. during JPEG decoding).
|
||||||
im = Image.open("Tests/images/flower.jpg")
|
im = Image.open("Tests/images/flower.jpg")
|
||||||
assert im.size == (480, 360)
|
self.assertEqual(im.size, (480, 360))
|
||||||
dst_size = (48, 36)
|
dst_size = (48, 36)
|
||||||
# Reference is cropped image resized to destination
|
# Reference is cropped image resized to destination
|
||||||
reference = im.crop((0, 0, 473, 353)).resize(dst_size, Image.BICUBIC)
|
reference = im.crop((0, 0, 473, 353)).resize(dst_size, Image.BICUBIC)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user