Skip to content

test: add unit tests for speaker diarization assignment - #4040

Open
nassarofficial wants to merge 1 commit into
mainfrom
test/coverage-speaker-diarization
Open

test: add unit tests for speaker diarization assignment#4040
nassarofficial wants to merge 1 commit into
mainfrom
test/coverage-speaker-diarization

Conversation

@nassarofficial

Copy link
Copy Markdown
Contributor

Add unit tests for docling.utils.speaker_diarization that lock down how ASR transcript cues get speaker labels. assign_speakers is pure time-overlap logic: empty diarization leaves items unchanged, empty transcripts stay empty, each cue is labeled with the diarization segment of maximum positive overlap, no-overlap and zero-length (missing start_time/end_time) cues leave speaker unset, and equal overlaps keep the first winner because the comparison is strict >. diarize() is only covered for the soft-fail path—when Resemblyzer (or related video extras) cannot be imported, it returns an empty DiarizationResult instead of raising—so the suite stays in the core CI lane without loading embedding models or decoding audio.

Cover assign_speakers overlap, empty, and missing-time edge cases, plus
the diarize() missing-dependency fallback, without loading Resemblyzer.

Signed-off-by: Ahmed Nassar AHN@zurich.ibm.com <AHN@zurich.ibm.com>
@github-actions

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @nassarofficial, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant