Fix unit tests.

This commit is contained in:
iabdalkader 2019-03-30 17:44:31 +02:00
parent 403911c598
commit 3f8df7178f
5 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path):
import image
lab = image.rgb_to_lab((120, 200, 120))
return (lab[0] == 76 and lab[1] == -44 and lab[2] == 34)
return (lab[0] == 74 and lab[1] == -38 and lab[2] == 30)

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path):
import image
rgb = image.lab_to_rgb((76, -44, 34))
return (rgb[0] == 118 and rgb[1] == 207 and rgb[2] == 122)
rgb = image.lab_to_rgb((74, -38, 30))
return (rgb[0] == 123 and rgb[1] == 198 and rgb[2] == 123)

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path):
import image
gs = image.rgb_to_grayscale((120, 200, 120))
return (gs == 182)
return (gs == 167)

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path):
import image
rgb = image.grayscale_to_rgb(182)
return (rgb[0] == 182 and rgb[1] == 182 and rgb[2] == 182)
return (rgb[0] == 181 and rgb[1] == 182 and rgb[2] == 181)

View File

@ -7,6 +7,6 @@ def unittest(data_path, temp_path):
img = image.Image("unittest/data/blobs.ppm", copy_to_fb=True)
blobs = img.find_blobs(thresholds, pixels_threshold=2000, area_threshold=200)
return blobs[0][0:-3] == (122, 41, 96, 81, 6228, 168, 82) and\
blobs[1][0:-3] == (44, 40, 77, 89, 5113, 80, 84) and\
blobs[2][0:-3] == (210, 40, 71, 82, 3890, 249, 76)
return [int(x) for x in blobs[0][0:-5]] == [122, 41, 97, 82, 6228, 168, 82] and\
[int(x) for x in blobs[1][0:-5]] == [44, 40, 78, 90, 5113, 80, 84] and\
[int(x) for x in blobs[2][0:-5]] == [210, 40, 72, 83, 3890, 249, 76]