Skip to content

Add test coverage for frame preprocessing in test_video_describer.py #6

Description

@chigwell

User Story
As a software developer,
I want to add test coverage verifying that video frames are properly preprocessed for model input in test_video_describer.py
so that we prevent silent failures caused by malformed model inputs.

Background
The current test mocks in test_video_describer.py (specifically test_get_video_descriptions and test_describe_frames) validate general method calls but don't verify critical preprocessing steps:

  1. The VideoDescriber.describe_frames() converts BGR frames to RGB using cv2.cvtColor before model processing
  2. The Blip model expects RGB-format PIL.Image inputs, but tests mock BlipProcessor without validating input transformations
  3. Unvalidated frame conversion risks subtle model performance degradation if preprocessing changes accidentally

Acceptance Criteria

  • Modify tests/test_video_describer.py to validate frame preprocessing:
    • Add assertions verifying mock BlipProcessor receives RGB-format PIL.Image inputs in test_describe_frames
    • Update @patch decorators to capture actual describe_frames arguments instead of generic mocks
  • Add concrete test case:
    • Generate test frames with known BGR values using numpy
    • Verify describe_frames converts them to RGB before model processing
    • Confirm tests fail if cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) is removed from production code
  • Ensure test validation:
    • Check color channel order in processed images matches model expectations
    • Verify test coverage for both URL-sourced and local-file video processing paths
    • Maintain test isolation (no external API calls or file I/O)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions