Update unit-tests.

This commit is contained in:
iabdalkader 2021-04-18 23:34:20 +02:00
parent 2c5347a77f
commit 7bc223d6b9
3 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path): def unittest(data_path, temp_path):
import image import image
lab = image.rgb_to_lab((120, 200, 120)) lab = image.rgb_to_lab((120, 200, 120))
return (lab[0] == 75 and lab[1] == -40 and lab[2] == 32) return (lab[0] == 75 and lab[1] == -40 and lab[2] == 34)

View File

@ -7,6 +7,6 @@ def unittest(data_path, temp_path):
img = image.Image("unittest/data/blobs.ppm", copy_to_fb=True) img = image.Image("unittest/data/blobs.ppm", copy_to_fb=True)
blobs = img.find_blobs(thresholds, pixels_threshold=2000, area_threshold=200) blobs = img.find_blobs(thresholds, pixels_threshold=2000, area_threshold=200)
return [int(x) for x in blobs[0][0:-5]] == [122, 41, 97, 82, 6266, 168, 82] and\ return [int(x) for x in blobs[0][0:-5]] == [122, 41, 98, 82, 6260, 168, 82] and\
[int(x) for x in blobs[1][0:-5]] == [44, 42, 78, 88, 5162, 80, 84] and\ [int(x) for x in blobs[1][0:-5]] == [44, 42, 78, 88, 5158, 80, 84] and\
[int(x) for x in blobs[2][0:-5]] == [210, 40, 72, 83, 3930, 249, 76] [int(x) for x in blobs[2][0:-5]] == [210, 40, 72, 82, 3986, 248, 77]

View File

@ -1,9 +1,9 @@
def unittest(data_path, temp_path): def unittest(data_path, temp_path):
import image import image
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True) img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
lines = img.find_lines(threshold = 10000, theta_margin = 25, rho_margin = 25) lines = img.find_lines(threshold = 5000, theta_margin = 25, rho_margin = 25)
return len(lines) == 4 and\ return len(lines) == 4 and\
lines[0][0:] == (22, 0, 22, 119, 119, 17340, 0, 22) and\ lines[0][0:] == (22, 0, 22, 119, 119, 8670, 0, 22) and\
lines[1][0:] == (0, 39, 159, 39, 159, 17340, 90, 39) and\ lines[1][0:] == (0, 39, 159, 39, 159, 8670, 90, 39) and\
lines[2][0:] == (57, 0, 57, 119, 119, 17340, 0, 57) and\ lines[2][0:] == (57, 0, 57, 119, 119, 8670, 0, 57) and\
lines[3][0:] == (0, 75, 159, 75, 159, 21420, 90, 75) lines[3][0:] == (0, 75, 159, 75, 159, 10710, 90, 75)