From 2e72dc6938307a952c060b5b12080d62456f310c Mon Sep 17 00:00:00 2001 From: Bolor-Erdene Jagdagdorj Date: Tue, 21 Jan 2025 10:56:49 -0800 Subject: [PATCH] fix unit test and precommit --- tests/unit/target/test_realtime_target.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/unit/target/test_realtime_target.py b/tests/unit/target/test_realtime_target.py index 76d63dadb..6872f82f3 100644 --- a/tests/unit/target/test_realtime_target.py +++ b/tests/unit/target/test_realtime_target.py @@ -40,14 +40,19 @@ async def test_send_prompt_async(target): prompt_request = PromptRequestResponse(request_pieces=[request_piece]) with ( - patch("pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.connect", next_callable=AsyncMock) as mock_connect, + patch( + "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.connect", next_callable=AsyncMock + ) as mock_connect, patch( "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.receive_events", new_callable=AsyncMock ) as mock_receive_events, patch( - "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.send_response_create", new_callable=AsyncMock + "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.send_response_create", + new_callable=AsyncMock, ) as mock_send_response_create, - patch("pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.send_text", new_callable=AsyncMock) as mock_send_text, + patch( + "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.send_text", new_callable=AsyncMock + ) as mock_send_text, patch( "pyrit.prompt_target.openai.openai_realtime_target.RealtimeTarget.save_audio", new_callable=AsyncMock ) as mock_save_audio, @@ -72,7 +77,6 @@ async def test_send_prompt_async(target): assert response.request_pieces[0].converted_value == "Hello" assert response.request_pieces[1].converted_value == "response_audio.wav" - @pytest.mark.asyncio