MCPcopy Create free account
hub / github.com/smacke/ffsubsync / test_offset

Function test_offset

tests/test_subtitles.py:71–88  ·  view source on GitHub ↗
(offset)

Source from the content-addressed store, hash-verified

69
70@pytest.mark.parametrize("offset", [1, 1.5, -2.3])
71def test_offset(offset):
72 parser = GenericSubtitleParser()
73 offseter = SubtitleShifter(offset)
74 pipe = make_pipeline(parser, offseter)
75 pipe.fit(BytesIO(fake_srt))
76 for sub_orig, sub_offset in zip(parser.subs_, offseter.subs_):
77 assert (
78 abs(
79 sub_offset.start.total_seconds()
80 - sub_orig.start.total_seconds()
81 - offset
82 )
83 < 1e-6
84 )
85 assert (
86 abs(sub_offset.end.total_seconds() - sub_orig.end.total_seconds() - offset)
87 < 1e-6
88 )
89
90
91@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

SubtitleShifterClass · 0.90
make_pipelineFunction · 0.90
fitMethod · 0.45

Tested by

no test coverage detected