diff --git a/tests/test_processors/test_asr.py b/tests/test_processors/test_asr.py index 0f46d0d..599d8a3 100644 --- a/tests/test_processors/test_asr.py +++ b/tests/test_processors/test_asr.py @@ -575,7 +575,8 @@ class TestStateRecording: processor = ASRProcessor(state_manager=mock_state_manager) mock_state_manager.load.return_value = mock_state - with patch.object(processor, "_try_official_subtitle", side_effect=Exception("Network error")): + # _try_official_subtitle 返回 None(无字幕) + with patch.object(processor, "_try_official_subtitle", return_value=None): with patch.object(processor, "_run_whisper", side_effect=Exception("Whisper error")): input_data = ASRInput( content_id="BV1xx", @@ -583,7 +584,7 @@ class TestStateRecording: video_path=str(video_path) ) - with pytest.raises(Exception): + with pytest.raises(Exception, match="Whisper error"): await processor.process(input_data) # 应该调用 mark_step_failed