Skip to content

Commit d22fe41

Browse files
committed
Reorganised test to use parametrize
1 parent 38a520c commit d22fe41

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Tests/test_imageops.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,11 @@ def test_fit_same_ratio():
102102
assert new_im.size == (1000, 755)
103103

104104

105-
def test_contain():
106-
# Same ratio
105+
@pytest.mark.parametrize("new_size", ((256, 256), (512, 256), (256, 512)))
106+
def test_contain(new_size):
107107
im = hopper()
108-
new_size = (im.width * 2, im.height * 2)
109108
new_im = ImageOps.contain(im, new_size)
110-
assert new_im.size == new_size
111-
112-
for new_size in [
113-
(im.width * 4, im.height * 2),
114-
(im.width * 2, im.height * 4),
115-
]:
116-
new_im = ImageOps.contain(im, new_size)
117-
assert new_im.size == (im.width * 2, im.height * 2)
109+
assert new_im.size == (256, 256)
118110

119111

120112
def test_pad():

0 commit comments

Comments
 (0)