-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_utils.py
More file actions
36 lines (27 loc) · 965 Bytes
/
test_utils.py
File metadata and controls
36 lines (27 loc) · 965 Bytes
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
from PIL import ImageGrab
from change_analyzer.utils import image_pad_resize_to, iou
def test_image_pad_resize_to_wide():
size = (800, 400)
im = image_pad_resize_to(ImageGrab.grab(), size)
im.show()
assert im.size == size
# def test_image_pad_resize_to_square():
# size = (800, 800)
# im = image_pad_resize_to(ImageGrab.grab(), size)
# # im.show()
# assert im.size == size
#
#
# def test_image_pad_resize_to_tall():
# size = (400, 800)
# im = image_pad_resize_to(ImageGrab.grab(), size)
# # im.show()
# assert im.size == size
def test_zero_iou():
rect0 = {"x": 0, "y": 0, "width": 100, "height": 100}
rect1 = {"x": 101, "y": 101, "width": 100, "height": 100}
assert iou(rect0, rect1) == 0
def test_full_iou():
rect0 = {"x": 0, "y": 0, "width": 100, "height": 100}
rect1 = {"x": 0, "y": 0, "width": 100, "height": 100}
assert iou(rect0, rect1) == 1