-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_skullphonize.py
43 lines (36 loc) · 1.32 KB
/
test_skullphonize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# test_skullphonize.py
# Eric Graves
# created 02/22/20
# A file to test the skullphonizer using pytest. Since input/output are images,
# there are not very many possible tests outside of weirdly-shaped images and
# various file types. Mostly, we just care that the code compiles and runs
# without throwing errors, since image quality is hard to test for (without
# comparing versus sample outputs).
from skullphonize_image import skullphonize_img
from PIL import Image
import pytest
IMG_SQUARE = 'IMG_3723_ART.PNG' # Bad practice: should have sparate test images for different file types
IMG_PORT = 'lighthouse.jpg'
IMG_LAND = 'planets.jpg'
SCALE = 20
def test_square():
"""
Test with a Square image.
"""
out_img = Image.fromarray(skullphonize_img(IMG_SQUARE, SCALE))
def test_landscape():
"""
Test with a Landscape image. (vconcat/hconcat tests)
"""
out_img = Image.fromarray(skullphonize_img(IMG_LAND, SCALE))
def test_portrait():
"""
Test with a Portrait image. (vconcat/hconcat tests)
"""
out_img = Image.fromarray(skullphonize_img(IMG_PORT, SCALE))
def test_input_format():
"""
Test image formats (PNG and JPG). Already covered elsewhere.
"""
jpg_img = Image.fromarray(skullphonize_img(IMG_PORT, SCALE))
png_img = Image.fromarray(skullphonize_img(IMG_SQUARE, SCALE))