Files
ai-training/_docs/02_tasks/AZ-156_test_label_validation.md
T
Oleksandr Bezdieniezhnykh 142c6c4de8 Refactor constants management to use Pydantic BaseModel for configuration
- Replaced module-level path variables in constants.py with a structured Pydantic Config class.
- Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure.
- Fixed bugs related to image processing and model saving.
- Enhanced test infrastructure to accommodate the new configuration approach.

This refactor improves code maintainability and clarity by centralizing configuration management.
2026-03-27 18:18:30 +02:00

1.7 KiB

Label Validation Tests

Task: AZ-156_test_label_validation Name: Label Validation Tests Description: Implement 5 blackbox tests for YOLO label validation — valid labels, out-of-range coords, missing files, multi-line corruption Complexity: 1 point Dependencies: AZ-152_test_infrastructure Component: Blackbox Tests Jira: AZ-156 Epic: AZ-151

Problem

Labels must be validated before dataset formation. Tests verify the check_label function correctly accepts valid labels and rejects corrupted ones.

Outcome

  • 5 passing pytest tests in tests/test_label_validation.py

Scope

Included

  • BT-LBL-01: Valid label accepted (returns True)
  • BT-LBL-02: Label with x > 1.0 rejected (returns False)
  • BT-LBL-03: Label with height > 1.0 rejected (returns False)
  • BT-LBL-04: Missing label file rejected (returns False)
  • BT-LBL-05: Multi-line label with one corrupted line (returns False)

Excluded

  • Integration with dataset formation (separate task)

Acceptance Criteria

AC-1: Valid label Given label file with content 0 0.5 0.5 0.1 0.1 When check_label(path) is called Then returns True

AC-2: x out of range Given label file with content 0 1.5 0.5 0.1 0.1 When check_label(path) is called Then returns False

AC-3: height out of range Given label file with content 0 0.5 0.5 0.1 1.2 When check_label(path) is called Then returns False

AC-4: Missing file Given non-existent file path When check_label(path) is called Then returns False

AC-5: Multi-line corruption Given label with 0 0.5 0.5 0.1 0.1\n3 0.5 0.5 0.1 1.5 When check_label(path) is called Then returns False

Constraints

  • Label files are generated in tmp_path at test time
  • No external fixtures needed