MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / test_read_eof

Method test_read_eof

tests/test_video_stream.py:291–302  ·  view source on GitHub ↗

Ensure calling `read()` handles the end of the video correctly.

(self, vs_type: ty.Callable[..., VideoStream], test_video: VideoParameters)

Source from the content-addressed store, hash-verified

289 stream = vs_type(test_video.path)
290
291 def test_read_eof(self, vs_type: ty.Callable[..., VideoStream], test_video: VideoParameters):
292 """Ensure calling `read()` handles the end of the video correctly."""
293 stream = vs_type(test_video.path)
294 # To make the test faster, we seek to the second last frame.
295 stream.seek(test_video.total_frames - 1)
296 while stream.read() is not False:
297 pass
298 # TODO: On some videos, the PyAV backend seems to drop a frame. See where this occurs.
299 if vs_type == VideoStreamAv:
300 assert stream.frame_number in (test_video.total_frames, test_video.total_frames - 1)
301 else:
302 assert stream.frame_number == test_video.total_frames
303
304 def test_seek_past_eof(
305 self, vs_type: ty.Callable[..., VideoStream], test_video: VideoParameters

Callers

nothing calls this directly

Calls 2

seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected