Skip to content

Commit abe405f

Browse files
committed
Soften float tests down to a nanosecond
To tolerate epsilon added to timecode float representation
1 parent ead6b57 commit abe405f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/test_timecode.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ def test_toggle_fractional_frame_3():
650650
def test_timestamp_realtime_1():
651651
frames = 12345
652652
ts = frames*1/24
653-
assert Timecode(24, frames=frames).to_realtime(True) == ts
653+
realtime = Timecode(24, frames=frames).to_realtime(True)
654+
assert abs(realtime - ts) < 1e-09
654655

655656

656657
def test_timestamp_realtime_2():
@@ -855,7 +856,7 @@ def test_bug_report_32():
855856
framerate = "30000/1001"
856857
seconds = 500
857858
tc1 = Timecode(framerate, start_seconds=seconds)
858-
assert seconds == tc1.float
859+
assert abs(tc1.float - seconds) < 1e-09
859860

860861

861862
def test_set_timecode_method():
@@ -1009,7 +1010,7 @@ def test_float_representation_roundtrip(framerate):
10091010
"""Test float representation of Timecode."""
10101011
mismatched = 0
10111012
# Close enough to max frame across our supported framerates.
1012-
num_frames = Timecode(framerate, "23:59:59;23").frame_number
1013+
num_frames = Timecode(framerate, "24:00:00;00").frame_number
10131014
max_samples = 50_000
10141015

10151016
if num_frames <= max_samples:

0 commit comments

Comments
 (0)