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

Function test_framerate

tests/test_timecode.py:32–67  ·  view source on GitHub ↗

Test FrameTimecode constructor argument "fps".

()

Source from the content-addressed store, hash-verified

30
31
32def test_framerate():
33 """Test FrameTimecode constructor argument "fps"."""
34 # Not passing fps results in TypeError.
35 with pytest.raises(TypeError):
36 FrameTimecode() # type: ignore[call-arg]
37 with pytest.raises(TypeError):
38 FrameTimecode(timecode=0, fps=None)
39 with pytest.raises(TypeError):
40 FrameTimecode(
41 timecode=None, # type: ignore[arg-type]
42 fps=FrameTimecode(timecode=0, fps=None),
43 )
44 # Test zero FPS/negative.
45 with pytest.raises(ValueError):
46 FrameTimecode(timecode=0, fps=0.0)
47 with pytest.raises(ValueError):
48 FrameTimecode(timecode=0, fps=-1.0)
49 with pytest.raises(ValueError):
50 FrameTimecode(timecode=0, fps=-100.0)
51 with pytest.raises(ValueError):
52 FrameTimecode(timecode=0, fps=0.0)
53 with pytest.raises(ValueError):
54 FrameTimecode(timecode=0, fps=-1.0)
55 with pytest.raises(ValueError):
56 FrameTimecode(timecode=0, fps=-1000.0)
57 with pytest.raises(ValueError):
58 FrameTimecode(timecode=0, fps=MAX_FPS_DELTA / 2)
59 # Test positive framerates.
60 assert FrameTimecode(timecode=0, fps=1.0).frame_num == 0
61 assert FrameTimecode(timecode=0, fps=10.0).frame_num == 0
62 assert FrameTimecode(timecode=0, fps=MAX_FPS_DELTA * 2).frame_num == 0
63 assert FrameTimecode(timecode=0, fps=1000.0).frame_num == 0
64 assert FrameTimecode(timecode=0, fps=1000.0).frame_num == 0
65 # Reject framerates too small for equality testing or potential divide by zero situations.
66 with pytest.raises(ValueError):
67 assert FrameTimecode(timecode=0, fps=MAX_FPS_DELTA).frame_num == 0
68
69
70def test_frame_rate_property():

Callers

nothing calls this directly

Calls 1

FrameTimecodeClass · 0.90

Tested by

no test coverage detected