add test that will fail on get_frame(clip.duration) bug #2383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was going to make an issue, but it was actually easier to add a test case that would fail on the bug I found.
I found that if I pass the duration of the clip to .get_frame() it does not return the last frame, but rather the first frame. even passing get_frame(clip.duration-1/clip.fps) does not return the last frame. Only get_frame.duration(clip.duration- 2/clip.fps) will return a frame near the end of the video (I have not confirmed if its actually the last frame).
I have confirmed the test fails locally. The errors are not exactly what I was expecting (I.e I expect the assertion to fail because the requesting get_frame(0) and get_frame(duration) return the same value) but instead I get indexing errors.
Maybe the reason for this will be clearer to someone who understands the codebase better, but I hope this test demonstrates the class of error.
tests/
This is the context in which I found and fixed the bug for my usecase:
https://github.com/blooop/bencher/pull/551/files