Skip to content

Update test_detection.py to match refactored detection.py API#277

Merged
tkswanson merged 2 commits into
detect_include_categoriesfrom
copilot/update-test-detection-reflect-new-module
May 1, 2026
Merged

Update test_detection.py to match refactored detection.py API#277
tkswanson merged 2 commits into
detect_include_categoriesfrom
copilot/update-test-detection-reflect-new-module

Conversation

Copy link
Copy Markdown

Copilot AI commented May 1, 2026

detection.py was refactored to consolidate _convert_onnx_detections and _convert_yolo_detections into a single _convert_detections(predictions, batch, letterbox, model_type) function, and parse_detections now expects category_label in each detection dict. The tests were left referencing the old API.

Changes

  • Imports: Replace removed _convert_onnx_detections / _convert_yolo_detections with _convert_detections
  • TestConvertOnnxDetections / TestConvertYoloDetections: Update all call sites to use the unified signature:
    # Before (functions no longer exist)
    convert_yolo_detections(preds, tensors, paths, frames, sizes, letterbox=False, model_type='yolov5')
    
    # After
    _convert_detections(preds, [tensors, paths, frames, sizes], letterbox=False, model_type='yolov5')
  • _make_detection_result + inline detection dicts: Add category_label key to detection entries to satisfy parse_detections' direct dict access
  • test_filepath_preserved: Fix stale assertion ('my_image.jpg') that was testing with a different path than what was in the batch; now constructs a distinct-path batch to properly validate preservation

@tkswanson tkswanson marked this pull request as ready for review May 1, 2026 20:21
@tkswanson tkswanson merged commit 6fcb01c into detect_include_categories May 1, 2026
@tkswanson tkswanson deleted the copilot/update-test-detection-reflect-new-module branch May 1, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants