mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
Resize tests for https://github.com/python-imaging/Pillow/pull/619 (plus flake8)
This commit is contained in:
parent
73eafbb55f
commit
134295bfd4
|
@ -1,7 +1,6 @@
|
|||
from tester import *
|
||||
|
||||
from PIL import Image, EpsImagePlugin
|
||||
import sys
|
||||
import io
|
||||
|
||||
if not EpsImagePlugin.has_ghostscript():
|
||||
|
@ -18,6 +17,7 @@ file1_compare_scale2 = "Tests/images/zero_bb_scale2.png"
|
|||
file2_compare = "Tests/images/non_zero_bb.png"
|
||||
file2_compare_scale2 = "Tests/images/non_zero_bb_scale2.png"
|
||||
|
||||
|
||||
def test_sanity():
|
||||
# Regular scale
|
||||
image1 = Image.open(file1)
|
||||
|
@ -45,18 +45,21 @@ def test_sanity():
|
|||
assert_equal(image2_scale2.size, (720, 504))
|
||||
assert_equal(image2_scale2.format, "EPS")
|
||||
|
||||
|
||||
def test_file_object():
|
||||
# issue 479
|
||||
image1 = Image.open(file1)
|
||||
with open(tempfile('temp_file.eps'), 'wb') as fh:
|
||||
image1.save(fh, 'EPS')
|
||||
|
||||
|
||||
def test_iobase_object():
|
||||
# issue 479
|
||||
image1 = Image.open(file1)
|
||||
with io.open(tempfile('temp_iobase.eps'), 'wb') as fh:
|
||||
image1.save(fh, 'EPS')
|
||||
|
||||
|
||||
def test_render_scale1():
|
||||
# We need png support for these render test
|
||||
codecs = dir(Image.core)
|
||||
|
@ -77,6 +80,7 @@ def test_render_scale1():
|
|||
image2_scale1_compare.load()
|
||||
assert_image_similar(image2_scale1, image2_scale1_compare, 10)
|
||||
|
||||
|
||||
def test_render_scale2():
|
||||
# We need png support for these render test
|
||||
codecs = dir(Image.core)
|
||||
|
@ -96,3 +100,21 @@ def test_render_scale2():
|
|||
image2_scale2_compare = Image.open(file2_compare_scale2).convert("RGB")
|
||||
image2_scale2_compare.load()
|
||||
assert_image_similar(image2_scale2, image2_scale2_compare, 10)
|
||||
|
||||
|
||||
def test_resize():
|
||||
# Arrange
|
||||
image1 = Image.open(file1)
|
||||
image2 = Image.open(file2)
|
||||
new_size = (100, 100)
|
||||
|
||||
# Act
|
||||
image1 = image1.resize(new_size)
|
||||
image2 = image1.resize(new_size)
|
||||
|
||||
# Assert
|
||||
assert_equal(image1.size, new_size)
|
||||
assert_equal(image2.size, new_size)
|
||||
|
||||
|
||||
# End of file
|
||||
|
|
Loading…
Reference in New Issue
Block a user