21 lines
629 B
Python
21 lines
629 B
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
SCRIPT = Path(__file__).parents[2] / "scripts" / "retile_yolo_dataset.py"
|
|
SPEC = importlib.util.spec_from_file_location("retile_yolo", SCRIPT)
|
|
assert SPEC and SPEC.loader
|
|
MODULE = importlib.util.module_from_spec(SPEC)
|
|
SPEC.loader.exec_module(MODULE)
|
|
|
|
|
|
def test_tile_starts_cover_edges_with_overlap() -> None:
|
|
assert MODULE.tile_starts(640, 384, 128) == [0, 256]
|
|
assert MODULE.tile_starts(700, 384, 128) == [0, 256, 316]
|
|
|
|
|
|
def test_tile_starts_reject_image_smaller_than_tile() -> None:
|
|
assert MODULE.tile_starts(320, 384, 128) == []
|