Ensure calling `read()` handles the end of the video correctly.
(self, vs_type: ty.Callable[..., VideoStream], test_video: VideoParameters)
| 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 |