@@ -218,9 +218,7 @@ async def gemini_api_client_async_request_streamed(
218218 return _GeminiApiStreamedResponse (chunks = chunks )
219219
220220 @activity .defn (name = "gemini_files_upload" )
221- async def gemini_files_upload (
222- self , req : _GeminiUploadFileRequest
223- ) -> types .File :
221+ async def gemini_files_upload (self , req : _GeminiUploadFileRequest ) -> types .File :
224222 self .file_upload_requests .append (req )
225223 return types .File (
226224 name = "files/test-uploaded-file" ,
@@ -229,9 +227,7 @@ async def gemini_files_upload(
229227 )
230228
231229 @activity .defn (name = "gemini_files_download" )
232- async def gemini_files_download (
233- self , req : _GeminiDownloadFileRequest
234- ) -> bytes :
230+ async def gemini_files_download (self , req : _GeminiDownloadFileRequest ) -> bytes :
235231 self .file_download_requests .append (req )
236232 return b"fake file content"
237233
@@ -1042,9 +1038,7 @@ async def test_chat_multi_turn(client: Client):
10421038# ===========================================================================
10431039
10441040
1045- def _apply_plugin_with_mock_client (
1046- client : Client , mock_responses : list [str ]
1047- ) -> Client :
1041+ def _apply_plugin_with_mock_client (client : Client , mock_responses : list [str ]) -> Client :
10481042 """Create a real GeminiPlugin with real activities but a mocked client.
10491043
10501044 Unlike ``apply_plugin``, this does NOT replace the activities. The
@@ -1101,16 +1095,18 @@ async def _gen():
11011095
11021096 # Mock file operations at the high-level SDK interface (these are what
11031097 # the real activities call).
1104- gemini .aio .files .upload = AsyncMock (
1098+ gemini .aio .files .upload = AsyncMock (
11051099 return_value = types .File (
11061100 name = "files/mock-uploaded" ,
11071101 uri = "https://fake.uri/files/mock-uploaded" ,
11081102 size_bytes = 42 ,
11091103 )
11101104 )
11111105 gemini .aio .files .download = AsyncMock (return_value = b"mock download content" )
1112- gemini .aio .file_search_stores .upload_to_file_search_store = AsyncMock (
1113- return_value = types .UploadToFileSearchStoreOperation .model_construct (name = "operations/mock-op" )
1106+ gemini .aio .file_search_stores .upload_to_file_search_store = AsyncMock (
1107+ return_value = types .UploadToFileSearchStoreOperation .model_construct (
1108+ name = "operations/mock-op"
1109+ )
11141110 )
11151111
11161112 plugin = GeminiPlugin (gemini )
@@ -1133,10 +1129,10 @@ async def test_full_integration_with_mock_client(client: Client):
11331129 new_client = _apply_plugin_with_mock_client (
11341130 client ,
11351131 [
1136- make_text_response ("Real activity response" ), # generate_content
1137- make_text_response ("Streamed via real activity" ), # generate_content_stream
1138- make_text_response ("Grounded RAG answer" ), # RAG query with file_search
1139- make_text_response ("" ), # file_search_stores.delete
1132+ make_text_response ("Real activity response" ), # generate_content
1133+ make_text_response ("Streamed via real activity" ), # generate_content_stream
1134+ make_text_response ("Grounded RAG answer" ), # RAG query with file_search
1135+ make_text_response ("" ), # file_search_stores.delete
11401136 ],
11411137 )
11421138
0 commit comments