All checks were successful
CI / lint-and-test (push) Successful in 11s
Reviewed-on: #1 Co-authored-by: pedro-bento <mail@pbento.pt> Co-committed-by: pedro-bento <mail@pbento.pt>
25 lines
730 B
Python
25 lines
730 B
Python
import cadence
|
|
from cadence import Segment, Word
|
|
|
|
|
|
def test_generate_combined_transcripts(make_track, tmp_path):
|
|
td = make_track(
|
|
name="video.mp4",
|
|
duration=2.0,
|
|
timeline=[Segment(0.0, 2.0, "keep")],
|
|
words=[Word("Hello.", 0.2, 0.5), Word("world.", 0.6, 0.9)],
|
|
)
|
|
out = tmp_path / "captions"
|
|
|
|
cadence.generate_combined_transcripts([td], out)
|
|
|
|
srt = out.with_suffix(".srt")
|
|
assert srt.exists()
|
|
assert srt.stat().st_size > 0
|
|
|
|
llm_transcript = out.with_name(f"{out.stem}_llm_transcript.txt")
|
|
assert llm_transcript.exists()
|
|
assert llm_transcript.stat().st_size > 0
|
|
|
|
# Atomic writes must not leave temp files behind.
|
|
assert not list(tmp_path.glob("*.tmp"))
|