@@ -74,7 +74,11 @@ async def test_batch_localize_text_real_api(self):
7474 async with self .engine :
7575 result = await self .engine .batch_localize_text (
7676 "Welcome to our application" ,
77- {"source_locale" : "en" , "target_locales" : ["es" , "fr" , "de" ], "fast" : True },
77+ {
78+ "source_locale" : "en" ,
79+ "target_locales" : ["es" , "fr" , "de" ],
80+ "fast" : True ,
81+ },
7882 )
7983
8084 assert isinstance (result , list )
@@ -208,16 +212,19 @@ async def test_fast_mode(self):
208212 async def test_concurrent_processing_performance (self ):
209213 """Test concurrent processing performance improvement"""
210214 import time
211-
212- large_object = {f"key_{ i } " : f"Test content number { i } for performance testing" for i in range (10 )}
215+
216+ large_object = {
217+ f"key_{ i } " : f"Test content number { i } for performance testing"
218+ for i in range (10 )
219+ }
213220
214221 async with self .engine :
215222 # Test sequential processing
216223 start_time = time .time ()
217224 await self .engine .localize_object (
218225 large_object ,
219226 {"source_locale" : "en" , "target_locale" : "es" },
220- concurrent = False
227+ concurrent = False ,
221228 )
222229 sequential_time = time .time () - start_time
223230
@@ -226,7 +233,7 @@ async def test_concurrent_processing_performance(self):
226233 await self .engine .localize_object (
227234 large_object ,
228235 {"source_locale" : "en" , "target_locale" : "es" },
229- concurrent = True
236+ concurrent = True ,
230237 )
231238 concurrent_time = time .time () - start_time
232239
@@ -238,13 +245,12 @@ async def test_batch_localize_objects(self):
238245 objects = [
239246 {"greeting" : "Hello" , "question" : "How are you?" },
240247 {"farewell" : "Goodbye" , "thanks" : "Thank you" },
241- {"welcome" : "Welcome" , "help" : "Can I help you?" }
248+ {"welcome" : "Welcome" , "help" : "Can I help you?" },
242249 ]
243250
244251 async with self .engine :
245252 results = await self .engine .batch_localize_objects (
246- objects ,
247- {"source_locale" : "en" , "target_locale" : "es" }
253+ objects , {"source_locale" : "en" , "target_locale" : "es" }
248254 )
249255
250256 assert len (results ) == 3
@@ -337,15 +343,15 @@ async def test_workflow_id_consistency(self, mock_post):
337343 async def test_concurrent_chunk_processing (self , mock_post ):
338344 """Test concurrent chunk processing"""
339345 import asyncio
340-
346+
341347 # Mock API response with delay to test concurrency
342348 async def mock_response_with_delay (* args , ** kwargs ):
343349 await asyncio .sleep (0.1 ) # Small delay
344- mock_resp = type (' MockResponse' , (), {})()
350+ mock_resp = type (" MockResponse" , (), {})()
345351 mock_resp .is_success = True
346352 mock_resp .json = lambda : {"data" : {"key" : "value" }}
347353 return mock_resp
348-
354+
349355 mock_post .side_effect = mock_response_with_delay
350356
351357 # Create a payload that will be chunked
@@ -356,7 +362,7 @@ async def mock_response_with_delay(*args, **kwargs):
356362 await self .engine .localize_object (
357363 large_payload ,
358364 {"source_locale" : "en" , "target_locale" : "es" },
359- concurrent = True
365+ concurrent = True ,
360366 )
361367 concurrent_time = asyncio .get_event_loop ().time () - start_time
362368
0 commit comments