File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 55from requests import Response
66
77
8- class MatchDeleted (Exception ):
8+ class MatchProcessing (Exception ):
99 """
1010 Exception raised when a query is made with an image which matches a target
11- which has recently been deleted.
11+ which is processing or has recently been deleted.
1212 """
1313
1414 def __init__ (self , response : Response ) -> None :
Original file line number Diff line number Diff line change 1111
1212from ._authorization import authorization_header , rfc_1123_date
1313from ._result_codes import raise_for_result_code
14- from .exceptions import MatchDeleted , MaxNumResultsOutOfRange
14+ from .exceptions import MatchProcessing , MaxNumResultsOutOfRange
1515from .include_target_data import CloudRecoIncludeTargetData
1616
1717
@@ -106,7 +106,7 @@ def query(
106106 raise MaxNumResultsOutOfRange (response = response )
107107
108108 if 'No content to map due to end-of-input' in response .text :
109- raise MatchDeleted (response = response )
109+ raise MatchProcessing (response = response )
110110
111111 raise_for_result_code (
112112 response = response ,
Original file line number Diff line number Diff line change 1818 BadImage ,
1919 Fail ,
2020 ImageTooLarge ,
21- MatchDeleted ,
21+ MatchProcessing ,
2222 MetadataTooLarge ,
2323 ProjectInactive ,
2424 TargetNameExist ,
@@ -273,22 +273,26 @@ def test_target_status_not_success(
273273 assert exc .value .response .status_code == codes .FORBIDDEN
274274
275275
276- def test_match_deleted (
276+ def test_match_processing (
277277 vws_client : VWS ,
278278 cloud_reco_client : CloudRecoService ,
279279 high_quality_image : io .BytesIO ,
280280) -> None :
281281 """
282- A ``MatchDeleted `` exception is raised when a deleted target is matched.
282+ A ``MatchProcessing `` exception is raised when a deleted target is matched.
283283 """
284284 target_id = vws_client .add_target (
285285 name = 'x' ,
286286 width = 1 ,
287287 image = high_quality_image ,
288288 )
289+ with pytest .raises (MatchProcessing ) as exc :
290+ cloud_reco_client .query (image = high_quality_image )
291+ assert exc .value .response .status_code == codes .INTERNAL_SERVER_ERROR
289292 vws_client .wait_for_target_processed (target_id = target_id )
293+ cloud_reco_client .query (image = high_quality_image )
290294 vws_client .delete_target (target_id = target_id )
291- with pytest .raises (MatchDeleted ) as exc :
295+ with pytest .raises (MatchProcessing ) as exc :
292296 cloud_reco_client .query (image = high_quality_image )
293297
294298 assert exc .value .response .status_code == codes .INTERNAL_SERVER_ERROR
You can’t perform that action at this time.
0 commit comments