MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / test_get_timecode

Function test_get_timecode

tests/test_timecode.py:247–265  ·  view source on GitHub ↗

Test FrameTimecode get_timecode() method.

()

Source from the content-addressed store, hash-verified

245
246
247def test_get_timecode():
248 """Test FrameTimecode get_timecode() method."""
249 assert FrameTimecode(timecode=1.0, fps=1.0).get_timecode() == "00:00:01.000"
250 assert FrameTimecode(timecode=60.117, fps=60.0).get_timecode() == "00:01:00.117"
251 # 29.97 snaps to exact NTSC Fraction(30000, 1001); 3600.234s lands on the nearest
252 # NTSC frame at ~01:00:00.230 rather than the lossy-float result of "01:00:00.234".
253 assert FrameTimecode(timecode=3600.234, fps=29.97).get_timecode() == "01:00:00.230"
254
255 assert FrameTimecode(timecode="00:00:02.0000", fps=1.0).get_timecode() == "00:00:02.000"
256 assert FrameTimecode(timecode="00:00:00.5", fps=10.0).get_timecode() == "00:00:00.500"
257 # If a value is provided in seconds, we store that value internally now.
258 assert (
259 FrameTimecode(timecode="00:00:01.501", fps=10.0).get_timecode(nearest_frame=False)
260 == "00:00:01.501"
261 )
262 assert (
263 FrameTimecode(timecode="00:00:01.501", fps=10.0).get_timecode(nearest_frame=True)
264 == "00:00:01.500"
265 )
266
267
268def test_equality():

Callers

nothing calls this directly

Calls 2

FrameTimecodeClass · 0.90
get_timecodeMethod · 0.80

Tested by

no test coverage detected