`frame_rate` returns an exact Fraction; `framerate` returns the float equivalent.
()
| 68 | |
| 69 | |
| 70 | def 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 | |
| 89 | def test_frame_rate_for_vfr(): |
nothing calls this directly
no test coverage detected