@@ -222,6 +222,21 @@ def test_get_detector(gl: Groundlight, detector: Detector):
222222 assert isinstance (_detector , Detector )
223223
224224
225+ def test_get_detector_with_low_request_timeout (gl : Groundlight , detector : Detector ):
226+ """
227+ Verifies that get_detector respects the request_timeout parameter and raises a ReadTimeoutError when timeout is
228+ exceeded. Verifies that request_timeout parameter can be a float or a tuple.
229+ """
230+ with pytest .raises (ReadTimeoutError ):
231+ # Setting a very low request_timeout value should result in a timeout.
232+ # NOTE: request_timeout=0 seems to have special behavior that does not result in a timeout.
233+ gl .get_detector (id = detector .id , request_timeout = 1e-8 )
234+
235+ with pytest .raises (ReadTimeoutError ):
236+ # Ensure a tuple can be passed.
237+ gl .get_detector (id = detector .id , request_timeout = (1e-8 , 1e-8 ))
238+
239+
225240def test_get_detector_by_name (gl : Groundlight , detector : Detector ):
226241 _detector = gl .get_detector_by_name (name = detector .name )
227242 assert str (_detector )
@@ -352,14 +367,18 @@ def test_submit_image_query_with_human_review_param(gl: Groundlight, detector: D
352367
353368def test_submit_image_query_with_low_request_timeout (gl : Groundlight , detector : Detector , image : str ):
354369 """
355- Test that submit_image_query respects the request_timeout parameter and raises a ReadTimeoutError when timeout is
356- exceeded.
370+ Verifies that submit_image_query respects the request_timeout parameter and raises a ReadTimeoutError when timeout is
371+ exceeded. Verifies that request_timeout parameter can be a float or a tuple.
357372 """
358373 with pytest .raises (ReadTimeoutError ):
359374 # Setting a very low request_timeout value should result in a timeout.
360375 # NOTE: request_timeout=0 seems to have special behavior that does not result in a timeout.
361376 gl .submit_image_query (detector = detector , image = image , human_review = "NEVER" , request_timeout = 1e-8 )
362377
378+ with pytest .raises (ReadTimeoutError ):
379+ # Ensure a tuple can be passed.
380+ gl .submit_image_query (detector = detector , image = image , human_review = "NEVER" , request_timeout = (1e-8 , 1e-8 ))
381+
363382
364383@pytest .mark .skip_for_edge_endpoint (reason = "The edge-endpoint does not support passing detector metadata." )
365384def test_create_detector_with_metadata (gl : Groundlight ):
0 commit comments