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

Function test_get_frames

tests/test_timecode.py:211–228  ·  view source on GitHub ↗

Test FrameTimecode get_frames() method.

()

Source from the content-addressed store, hash-verified

209
210
211def test_get_frames():
212 """Test FrameTimecode get_frames() method."""
213 assert FrameTimecode(timecode=1, fps=1.0).frame_num == 1
214 assert FrameTimecode(timecode=1000, fps=60.0).frame_num == 1000
215 assert FrameTimecode(timecode=1000000000, fps=29.97).frame_num == 1000000000
216
217 assert FrameTimecode(timecode=1.0, fps=1.0).frame_num == int(1.0 / 1.0)
218 assert FrameTimecode(timecode=1000.0, fps=60.0).frame_num == int(1000.0 * 60.0)
219 # 29.97 snaps to exact NTSC Fraction(30000, 1001), so expected is computed from that
220 # rational rather than the lossy float multiplication.
221 assert FrameTimecode(timecode=1000000000.0, fps=29.97).frame_num == round(
222 1000000000.0 * 30000 / 1001
223 )
224
225 assert FrameTimecode(timecode="00:00:02.0000", fps=1.0).frame_num == 2
226 assert FrameTimecode(timecode="00:00:00.5", fps=10.0).frame_num == 5
227 assert FrameTimecode(timecode="00:00:01", fps=10.0).frame_num == 10
228 assert FrameTimecode(timecode="00:01:00.000", fps=1.0).frame_num == 60
229
230
231def test_get_seconds():

Callers

nothing calls this directly

Calls 1

FrameTimecodeClass · 0.90

Tested by

no test coverage detected