From 5fc4d512b330bb0cd347da4cbcca0fbe9687898a Mon Sep 17 00:00:00 2001 From: mastermaxx03 Date: Sat, 11 Oct 2025 13:40:55 +0530 Subject: [PATCH] test: Add failing test case for silent audio file --- tests/data/audio/silent_1s.wav | Bin 0 -> 88244 bytes tests/test_asr_pipeline.py | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/data/audio/silent_1s.wav diff --git a/tests/data/audio/silent_1s.wav b/tests/data/audio/silent_1s.wav new file mode 100644 index 0000000000000000000000000000000000000000..24d262ae6a46b45962262bc5ab949ea25d38de17 GIT binary patch literal 88244 zcmeIuu?c`M6a>&8CvXH;5md0XP}_jm**S#6WJu#0^6r}B%D2qZRQ42GzmDg1cWp$Z z+Mz@|^>3n$Bj5SkLVy4P0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ mfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009F37I*<=kO?;c literal 0 HcmV?d00001 diff --git a/tests/test_asr_pipeline.py b/tests/test_asr_pipeline.py index 595cd608..8a68bdc3 100644 --- a/tests/test_asr_pipeline.py +++ b/tests/test_asr_pipeline.py @@ -57,3 +57,29 @@ def test_asr_pipeline_conversion(test_audio_path): print(f"Transcribed text from {test_audio_path.name}:") for i, text_item in enumerate(texts): print(f" {i + 1}: {text_item.text}") + + +@pytest.fixture +def silent_audio_path(): + """Fixture to provide the path to a silent audio file.""" + path = Path("./tests/data/audio/silent_1s.wav") + if not path.exists(): + pytest.skip("Silent audio file for testing not found at " + str(path)) + return path + + +def test_asr_pipeline_with_silent_audio(silent_audio_path): + """ + Test that the ASR pipeline correctly handles silent audio files + by returning a PARTIAL_SUCCESS status. + """ + converter = get_asr_converter() + doc_result: ConversionResult = converter.convert(silent_audio_path) + + # This test will FAIL initially, which is what we want. + assert doc_result.status == ConversionStatus.PARTIAL_SUCCESS, ( + f"Status should be PARTIAL_SUCCESS for silent audio, but got {doc_result.status}" + ) + assert len(doc_result.document.texts) == 0, ( + "Document should contain zero text items" + )