Skip to content

Commit 3c2b4a6

Browse files
authored
Mock cv2.imencode to return numpy array (#118)
Update the test fixture in tests/om1_vlm/video/test_video_stream.py so that the mocked cv2.imencode returns a numpy.uint8 array (np.frombuffer(..., dtype=np.uint8)) instead of raw bytes. This makes the mock match the real cv2.imencode return type (success flag, ndarray) and avoids type mismatches in the tests.
1 parent a637aea commit 3c2b4a6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/om1_vlm/video/test_video_stream.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def get(self, prop_id):
5353
def mock_cv2():
5454
with patch("cv2.VideoCapture", MockVideoCapture) as mock:
5555
with patch("cv2.imencode") as mock_imencode:
56-
# Mock imencode to return a simple base64 string
57-
mock_imencode.return_value = (True, b"fake_image_data")
56+
mock_imencode.return_value = (
57+
True,
58+
np.frombuffer(b"fake_image_data", dtype=np.uint8),
59+
)
5860
yield mock
5961

6062

0 commit comments

Comments
 (0)