@@ -101,8 +101,15 @@ async def test_identifies_newest_us_and_uk_tags(self, cleanup):
101101 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
102102 mock_get .return_value = mock_service
103103
104- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
105- await cleanup ._analyze_tags (keep_count = 40 )
104+ (
105+ service ,
106+ all_tags ,
107+ tags_to_keep ,
108+ newest_us ,
109+ newest_uk ,
110+ tags_removed ,
111+ errors ,
112+ ) = await cleanup ._analyze_tags (keep_count = 40 )
106113
107114 assert newest_us is not None
108115 assert newest_us .tag == "country-us-model-1-459-0"
@@ -126,8 +133,15 @@ async def test_keeps_safeguards_plus_newest(self, cleanup):
126133 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
127134 mock_get .return_value = mock_service
128135
129- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
130- await cleanup ._analyze_tags (keep_count = 4 )
136+ (
137+ service ,
138+ all_tags ,
139+ tags_to_keep ,
140+ newest_us ,
141+ newest_uk ,
142+ tags_removed ,
143+ errors ,
144+ ) = await cleanup ._analyze_tags (keep_count = 4 )
131145
132146 # Should keep: newest US, newest UK, then next 2 newest by version
133147 assert len (tags_to_keep ) == 4
@@ -152,8 +166,15 @@ async def test_handles_keep_count_less_than_2(self, cleanup):
152166 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
153167 mock_get .return_value = mock_service
154168
155- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
156- await cleanup ._analyze_tags (keep_count = 1 ) # Should become 2
169+ (
170+ service ,
171+ all_tags ,
172+ tags_to_keep ,
173+ newest_us ,
174+ newest_uk ,
175+ tags_removed ,
176+ errors ,
177+ ) = await cleanup ._analyze_tags (keep_count = 1 ) # Should become 2
157178
158179 # Should still keep both safeguards
159180 assert len (tags_to_keep ) == 2
@@ -169,8 +190,15 @@ async def test_handles_no_tags(self, cleanup):
169190 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
170191 mock_get .return_value = mock_service
171192
172- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
173- await cleanup ._analyze_tags (keep_count = 40 )
193+ (
194+ service ,
195+ all_tags ,
196+ tags_to_keep ,
197+ newest_us ,
198+ newest_uk ,
199+ tags_removed ,
200+ errors ,
201+ ) = await cleanup ._analyze_tags (keep_count = 40 )
174202
175203 assert len (all_tags ) == 0
176204 assert len (tags_to_keep ) == 0
@@ -189,8 +217,15 @@ async def test_handles_only_us_tags(self, cleanup):
189217 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
190218 mock_get .return_value = mock_service
191219
192- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
193- await cleanup ._analyze_tags (keep_count = 40 )
220+ (
221+ service ,
222+ all_tags ,
223+ tags_to_keep ,
224+ newest_us ,
225+ newest_uk ,
226+ tags_removed ,
227+ errors ,
228+ ) = await cleanup ._analyze_tags (keep_count = 40 )
194229
195230 assert newest_us is not None
196231 assert newest_us .tag == "country-us-model-1-200-0"
@@ -202,8 +237,15 @@ async def test_handles_service_error(self, cleanup):
202237 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
203238 mock_get .side_effect = Exception ("Cloud Run API error" )
204239
205- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
206- await cleanup ._analyze_tags (keep_count = 40 )
240+ (
241+ service ,
242+ all_tags ,
243+ tags_to_keep ,
244+ newest_us ,
245+ newest_uk ,
246+ tags_removed ,
247+ errors ,
248+ ) = await cleanup ._analyze_tags (keep_count = 40 )
207249
208250 assert service is None
209251 assert len (errors ) == 1
@@ -250,7 +292,9 @@ async def test_preview_does_not_call_update(self, cleanup):
250292
251293 with (
252294 patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get ,
253- patch .object (cleanup , "_update_service_traffic" , new_callable = AsyncMock ) as mock_update ,
295+ patch .object (
296+ cleanup , "_update_service_traffic" , new_callable = AsyncMock
297+ ) as mock_update ,
254298 ):
255299 mock_get .return_value = mock_service
256300
@@ -278,7 +322,9 @@ async def test_calls_update_when_tags_to_remove(self, cleanup):
278322
279323 with (
280324 patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get ,
281- patch .object (cleanup , "_update_service_traffic" , new_callable = AsyncMock ) as mock_update ,
325+ patch .object (
326+ cleanup , "_update_service_traffic" , new_callable = AsyncMock
327+ ) as mock_update ,
282328 ):
283329 mock_get .return_value = mock_service
284330
@@ -299,7 +345,9 @@ async def test_does_not_call_update_when_nothing_to_remove(self, cleanup):
299345
300346 with (
301347 patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get ,
302- patch .object (cleanup , "_update_service_traffic" , new_callable = AsyncMock ) as mock_update ,
348+ patch .object (
349+ cleanup , "_update_service_traffic" , new_callable = AsyncMock
350+ ) as mock_update ,
303351 ):
304352 mock_get .return_value = mock_service
305353
@@ -322,7 +370,9 @@ async def test_handles_update_failure(self, cleanup):
322370
323371 with (
324372 patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get ,
325- patch .object (cleanup , "_update_service_traffic" , new_callable = AsyncMock ) as mock_update ,
373+ patch .object (
374+ cleanup , "_update_service_traffic" , new_callable = AsyncMock
375+ ) as mock_update ,
326376 ):
327377 mock_get .return_value = mock_service
328378 mock_update .side_effect = Exception ("Update failed" )
@@ -354,7 +404,9 @@ async def capture_update(service, tags_to_keep):
354404
355405 with (
356406 patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get ,
357- patch .object (cleanup , "_update_service_traffic" , side_effect = capture_update ) as mock_update ,
407+ patch .object (
408+ cleanup , "_update_service_traffic" , side_effect = capture_update
409+ ) as mock_update ,
358410 ):
359411 mock_get .return_value = mock_service
360412
@@ -388,8 +440,15 @@ async def test_sorts_versions_correctly(self, cleanup):
388440 with patch .object (cleanup , "_get_service" , new_callable = AsyncMock ) as mock_get :
389441 mock_get .return_value = mock_service
390442
391- service , all_tags , tags_to_keep , newest_us , newest_uk , tags_removed , errors = \
392- await cleanup ._analyze_tags (keep_count = 2 )
443+ (
444+ service ,
445+ all_tags ,
446+ tags_to_keep ,
447+ newest_us ,
448+ newest_uk ,
449+ tags_removed ,
450+ errors ,
451+ ) = await cleanup ._analyze_tags (keep_count = 2 )
393452
394453 # 1.100.0 > 1.10.0 > 1.9.0 numerically
395454 assert newest_us .tag == "country-us-model-1-100-0"
0 commit comments