This commit is contained in:
agomizi1cm committed 2026-08-09 21:41:44 +09:00
commit c5bcb95d74
172 files changed
+9487

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import pytest
from src.models import BoundingBox, PixelRegion
def test_bounding_box_properties() -> None:
box = BoundingBox(10, 20, 30, 50)
assert (box.width, box.height) == (20, 30)
assert (box.center_x, box.center_y) == (20, 35)
assert (box.foot_x, box.foot_y) == (20, 50)
assert box.area == 600
def test_pixel_region_contains_including_boundary() -> None:
region = PixelRegion(10, 20, 30, 40)
assert region.contains(10, 20)
assert region.contains(30, 40)
assert not region.contains(31, 40)
@pytest.mark.parametrize("coords", [(1, 0, 1, 2), (0, 2, 1, 2), (2, 0, 1, 2)])
def test_invalid_bounding_box(coords: tuple[int, int, int, int]) -> None:
with pytest.raises(ValueError):
BoundingBox(*coords)