mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08:56:35 +00:00
66fe1cc918
Made-with: Cursor
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
import constants as c
|
|
|
|
|
|
def test_fixture_images_dir_has_jpegs(fixture_images_dir):
|
|
jpgs = list(fixture_images_dir.glob("*.jpg"))
|
|
assert len(jpgs) == 100
|
|
|
|
|
|
def test_fixture_labels_dir_has_yolo_labels(fixture_labels_dir):
|
|
txts = list(fixture_labels_dir.glob("*.txt"))
|
|
assert len(txts) == 100
|
|
|
|
|
|
def test_fixture_onnx_model_bytes(fixture_onnx_model):
|
|
assert len(fixture_onnx_model) > 0
|
|
|
|
|
|
def test_fixture_classes_json_exists(fixture_classes_json):
|
|
assert fixture_classes_json.is_file()
|
|
assert fixture_classes_json.name == "classes.json"
|
|
|
|
|
|
def test_work_dir_layout(work_dir):
|
|
assert (work_dir / "images").is_dir()
|
|
assert (work_dir / "labels").is_dir()
|
|
|
|
|
|
def test_sample_image_label_paths(sample_image_label):
|
|
img, lbl = sample_image_label
|
|
assert img.suffix.lower() == ".jpg"
|
|
assert lbl.suffix == ".txt"
|
|
assert img.exists() and lbl.exists()
|
|
assert img.stem == lbl.stem
|
|
|
|
|
|
def test_sample_images_labels_factory(sample_images_labels):
|
|
img_dir, lbl_dir = sample_images_labels(3)
|
|
assert len(list(img_dir.glob("*.jpg"))) == 3
|
|
assert len(list(lbl_dir.glob("*.txt"))) == 3
|
|
|
|
|
|
def test_corrupted_label_content(corrupted_label):
|
|
text = corrupted_label.read_text(encoding="utf-8")
|
|
assert "1.5" in text
|
|
|
|
|
|
def test_edge_bbox_label_exists(edge_bbox_label):
|
|
assert edge_bbox_label.read_text(encoding="utf-8").strip()
|
|
|
|
|
|
def test_empty_label_file(empty_label):
|
|
assert empty_label.read_text(encoding="utf-8") == ""
|
|
|
|
|
|
def test_constants_patch_uses_tmp(constants_patch, tmp_path):
|
|
constants_patch(tmp_path)
|
|
assert c.azaion.startswith(str(tmp_path))
|
|
assert c.data_dir.startswith(str(tmp_path))
|
|
assert c.CURRENT_ONNX_MODEL.startswith(str(tmp_path))
|