Skip to content

Commit 4c4df38

Browse files
committed
Add unit test
1 parent 632891e commit 4c4df38

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

digital_image_processing/sepia.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
def make_sepia(img, factor: int):
9+
""" Function create sepia tone. Source: https://en.wikipedia.org/wiki/Sepia_(color) """
910
pixel_h, pixel_v = img.shape[0], img.shape[1]
1011

1112
def to_grayscale(blue, green, red):

digital_image_processing/test_digital_image_processing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import digital_image_processing.filters.convolve as conv
1010
import digital_image_processing.change_contrast as cc
1111
import digital_image_processing.convert_to_negative as cn
12+
import digital_image_processing.sepia as sp
1213
from cv2 import imread, cvtColor, COLOR_BGR2GRAY
1314
from numpy import array, uint8
1415
from PIL import Image
@@ -68,3 +69,8 @@ def test_median_filter():
6869
def test_sobel_filter():
6970
grad, theta = sob.sobel_filter(gray)
7071
assert grad.any() and theta.any()
72+
73+
74+
def test_sepia():
75+
sepia = sp.make_sepia(img, 20)
76+
assert sepia.all()

0 commit comments

Comments
 (0)