Matthias Bisping daa1da3a50 fix name
2022-04-13 13:17:23 +02:00

30 lines
893 B
Python

import pytest
from image_prediction.exceptions import InvalidBox
from image_prediction.info import Info
from image_prediction.stitching.utils import validate_box_size, validate_box_coords
def test_validate_fail_too_short():
box = {Info.WIDTH: 1, Info.HEIGHT: 0}
with pytest.raises(InvalidBox):
validate_box_size(box)
def test_validate_fail_too_thin():
box = {Info.WIDTH: 0, Info.HEIGHT: 1}
with pytest.raises(InvalidBox):
validate_box_size(box)
def test_validate_fail_xs_width_mismatch():
box = {Info.WIDTH: 2, Info.HEIGHT: 4, Info.X1: 0, Info.Y1: 0, Info.X2: 1, Info.Y2: 4}
with pytest.raises(InvalidBox):
validate_box_coords(box)
def test_validate_fail_ys_height_mismatch():
box = {Info.WIDTH: 2, Info.HEIGHT: 3, Info.X1: 0, Info.Y1: 0, Info.X2: 2, Info.Y2: 4}
with pytest.raises(InvalidBox):
validate_box_coords(box)