Skip to content

test(audio): cover the duration limit boundary - #378

Merged
ashrafee-dev merged 1 commit into
ashrafee-dev:mainfrom
noahkhomer18:test/150-duration-limit-boundary
Nov 16, 2026
Merged

ashrafee-dev merged 1 commit into
ashrafee-dev:mainfrom
noahkhomer18:test/150-duration-limit-boundary

Conversation

@noahkhomer18

Copy link
Copy Markdown
Contributor

Pins both edges of the audio duration limit.

Closes #150

What the suite proved before

test_duration_limit_precedes_model_inference used MAX_AUDIO_SECONDS = 1 and two seconds of decoded audio, so it only ever proved that over-limit audio is rejected. Nothing checked what happens at the limit itself.

What this adds

Two tests against the same decoding harness:

  • test_audio_exactly_at_the_duration_limit_is_accepted — exactly MAX_AUDIO_SECONDS of decoded audio is transcribed and the model is called once.
  • test_audio_one_frame_over_the_duration_limit_is_rejected — one frame over raises InvalidAudio("... exceeds ...") and the model is never called.

Both use the existing wave writer pattern, so no fixtures, no real audio files and no ffmpeg.

Verified

$ uv run pytest tests/test_transcription.py -q
4 passed, 1 warning in 0.01s

The new boundary test is not vacuous. Mutating the comparison in app/services/transcription.py from > to >= makes it fail:

FAILED tests/test_transcription.py::test_audio_exactly_at_the_duration_limit_is_accepted
1 failed, 3 passed

The source file is unchanged in this PR; only tests/test_transcription.py moves.

The suite only proved that over-limit audio is rejected. This pins both edges:
audio exactly at MAX_AUDIO_SECONDS is transcribed, and one frame over is
rejected before the model is called.

Verified by mutating the comparison in app/services/transcription.py from >
to >=: the exactly-at-the-limit test then fails, so the test does pin the
boundary rather than passing vacuously.

Closes ashrafee-dev#150
@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown

@noahkhomer18 is attempting to deploy a commit to the ashrafee-dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ashrafee-dev
ashrafee-dev merged commit 03ae723 into ashrafee-dev:main Nov 16, 2026
0 of 2 checks passed
@ashrafee-dev

Copy link
Copy Markdown
Owner

Thanks for your contribution! @noahkhomer18

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.

Test audio exactly at the duration limit

2 participants