mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 21:07:03 +01:00
The largest untested Python file left in the repo, at 356 lines against the cap. Tests land first so the split that follows is verified against tests that predate the seam. 63 tests: duration probing through both ffmpeg paths, the transcode fallback and temp-file cleanup, audio loading's three outcomes, linear resampling, cosine k-means, the ECAPA classifier loader, per-segment embedding extraction, and diarize_segments end to end. numpy is real here, not a double. It is a declared dependency, and the core of this file is clustering maths - assertions against a mocked numpy would prove nothing about whether two speakers actually get two labels. The _try_import seam passes numpy through while stubbing torch and speechbrain, so the tests still run in CI with neither installed. The clustering tests assert real properties: two opposed groups separate, magnitude is ignored because the metric is cosine, and a fixed seed reproduces. The last three coverage gaps were _load_audio's ffmpeg fallback in both outcomes, the minimum-slice widening, and the zero-iteration k-means branch. Split across six test modules after two intermediate arrangements went over the cap, and one move silently broke a test by separating it from its doubles - caught by the test count holding at 63 through every rearrangement. 338 tests pass in the directory, up from 275 by exactly the 63 added. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY |
||
|---|---|---|
| .. | ||
| contracts | ||
| evidence | ||
| memory | ||
| plans | ||
| sessions | ||
| specs | ||
| workflows | ||