(monkeypatch)
| 61 | |
| 62 | |
| 63 | def test_fit_assembles_sparse_signal(monkeypatch): |
| 64 | _stub_probe(monkeypatch, 120.0) |
| 65 | t = _transformer(segment_count=3, segment_duration=10) |
| 66 | # each segment returns a constant-1 window; everything else stays zero |
| 67 | monkeypatch.setattr( |
| 68 | t, "_extract_segment_speech", lambda fname, start: (start, np.ones(10 * SR)) |
| 69 | ) |
| 70 | t.fit("ref.mkv") |
| 71 | speech = t.transform() |
| 72 | assert len(speech) == int(120 * SR) + 2 |
| 73 | starts = t._segment_starts(120.0) |
| 74 | for s in starts: |
| 75 | assert np.all(speech[s * SR : s * SR + 10 * SR] == 1.0) |
| 76 | # a point well outside any sampled window is zero |
| 77 | gap = starts[0] * SR + 10 * SR + 5 |
| 78 | if gap < starts[1] * SR: |
| 79 | assert speech[gap] == 0.0 |
| 80 | |
| 81 | |
| 82 | def test_fit_tolerates_partial_segment_failures(monkeypatch): |
nothing calls this directly
no test coverage detected