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

Function test_frame_rate_property

tests/test_timecode.py:70–86  ·  view source on GitHub ↗

`frame_rate` returns an exact Fraction; `framerate` returns the float equivalent.

()

Source from the content-addressed store, hash-verified

68
69
70def test_frame_rate_property():
71 """`frame_rate` returns an exact Fraction; `framerate` returns the float equivalent."""
72 # Integer rate.
73 tc = FrameTimecode(timecode=0, fps=30.0)
74 assert tc.frame_rate == Fraction(30, 1)
75 assert isinstance(tc.frame_rate, Fraction)
76 assert tc.framerate == 30.0
77 assert isinstance(tc.framerate, float)
78 # Constructed directly from a Fraction (the exact form for NTSC rates).
79 tc = FrameTimecode(timecode=0, fps=Fraction(30000, 1001))
80 assert tc.frame_rate == Fraction(30000, 1001)
81 assert tc.framerate == pytest.approx(float(Fraction(30000, 1001)))
82 tc = FrameTimecode(timecode=0, fps=Fraction(24000, 1001))
83 assert tc.frame_rate == Fraction(24000, 1001)
84 # time_base equals 1 / frame_rate for CFR sources.
85 assert tc.frame_rate is not None
86 assert tc.time_base == 1 / tc.frame_rate
87
88
89def test_frame_rate_for_vfr():

Callers

nothing calls this directly

Calls 1

FrameTimecodeClass · 0.90

Tested by

no test coverage detected