@@ -95,8 +95,8 @@ def test_create_groundlight_with_retries():
9595 assert gl .api_client .configuration .retries .total == retries .total
9696
9797
98- def test_create_detector (gl : Groundlight , generate_test_detector_name : Callable ):
99- name = generate_test_detector_name ()
98+ def test_create_detector (gl : Groundlight , detector_name : Callable ):
99+ name = detector_name ()
100100 query = "Is there a dog?"
101101 _detector = gl .create_detector (name = name , query = query )
102102 assert str (_detector )
@@ -107,28 +107,28 @@ def test_create_detector(gl: Groundlight, generate_test_detector_name: Callable)
107107
108108 # Test creating dectors with other modes
109109 count_detector = gl .create_detector (
110- name = generate_test_detector_name (), query = query , mode = ModeEnum .COUNT , class_names = "dog"
110+ name = detector_name (), query = query , mode = ModeEnum .COUNT , class_names = "dog"
111111 )
112112 assert str (count_detector )
113113 multiclass_detector = gl .create_detector (
114- name = generate_test_detector_name (), query = query , mode = ModeEnum .MULTI_CLASS , class_names = ["dog" , "cat" ]
114+ name = detector_name (), query = query , mode = ModeEnum .MULTI_CLASS , class_names = ["dog" , "cat" ]
115115 )
116116 assert str (multiclass_detector )
117117
118118
119- def test_create_detector_with_pipeline_config (gl : Groundlight , generate_test_detector_name : Callable ):
119+ def test_create_detector_with_pipeline_config (gl : Groundlight , detector_name : Callable ):
120120 # "never-review" is a special model that always returns the same result with 100% confidence.
121121 # It's useful for testing.
122- name = generate_test_detector_name ("Test never-review" )
122+ name = detector_name ("Test never-review" )
123123 query = "Is there a dog (always-pass)?"
124124 pipeline_config = "never-review"
125125 _detector = gl .create_detector (name = name , query = query , pipeline_config = pipeline_config )
126126 assert str (_detector )
127127 assert isinstance (_detector , Detector )
128128
129129
130- def test_create_detector_with_edge_pipeline_config (gl : Groundlight , generate_test_detector_name : Callable ):
131- name = generate_test_detector_name ("Test edge-pipeline-config" )
130+ def test_create_detector_with_edge_pipeline_config (gl : Groundlight , detector_name : Callable ):
131+ name = detector_name ("Test edge-pipeline-config" )
132132 query = "Is there a dog (edge-config)?"
133133 _detector = gl .create_detector (
134134 name = name ,
@@ -140,10 +140,10 @@ def test_create_detector_with_edge_pipeline_config(gl: Groundlight, generate_tes
140140 assert isinstance (_detector , Detector )
141141
142142
143- def test_create_detector_with_confidence_threshold (gl : Groundlight , generate_test_detector_name : Callable ):
143+ def test_create_detector_with_confidence_threshold (gl : Groundlight , detector_name : Callable ):
144144 # "never-review" is a special model that always returns the same result with 100% confidence.
145145 # It's useful for testing.
146- name = generate_test_detector_name ("Test with confidence" )
146+ name = detector_name ("Test with confidence" )
147147 query = "Is there a dog in the image?"
148148 pipeline_config = "never-review"
149149 confidence_threshold = 0.825
@@ -196,8 +196,8 @@ def test_create_detector_with_confidence_threshold(gl: Groundlight, generate_tes
196196
197197
198198@pytest .mark .skip_for_edge_endpoint (reason = "The edge-endpoint does not support passing detector metadata." )
199- def test_create_detector_with_everything (gl : Groundlight , generate_test_detector_name : Callable ):
200- name = generate_test_detector_name ()
199+ def test_create_detector_with_everything (gl : Groundlight , detector_name : Callable ):
200+ name = detector_name ()
201201 query = "Is there a dog?"
202202 group_name = "Test group"
203203 confidence_threshold = 0.825
@@ -231,9 +231,9 @@ def test_list_detectors(gl: Groundlight):
231231 assert isinstance (detectors , PaginatedDetectorList )
232232
233233
234- def test_get_or_create_detector (gl : Groundlight , generate_test_detector_name : Callable ):
234+ def test_get_or_create_detector (gl : Groundlight , detector_name : Callable ):
235235 # With a unique name, we should be creating a new detector.
236- unique_name = generate_test_detector_name ()
236+ unique_name = detector_name ()
237237 query = "Is there a dog?"
238238 detector = gl .get_or_create_detector (name = unique_name , query = query )
239239 assert str (detector )
@@ -409,8 +409,8 @@ def test_submit_image_query_with_low_request_timeout(gl: Groundlight, detector:
409409
410410
411411@pytest .mark .skip_for_edge_endpoint (reason = "The edge-endpoint does not support passing detector metadata." )
412- def test_create_detector_with_metadata (gl : Groundlight , generate_test_detector_name : Callable ):
413- name = generate_test_detector_name ()
412+ def test_create_detector_with_metadata (gl : Groundlight , detector_name : Callable ):
413+ name = detector_name ()
414414 query = "Is there a dog?"
415415 metadata = generate_random_dict (target_size_bytes = 200 )
416416 detector = gl .create_detector (name = name , query = query , metadata = metadata )
@@ -421,8 +421,8 @@ def test_create_detector_with_metadata(gl: Groundlight, generate_test_detector_n
421421
422422
423423@pytest .mark .skip_for_edge_endpoint (reason = "The edge-endpoint does not support passing detector metadata." )
424- def test_get_or_create_detector_with_metadata (gl : Groundlight , generate_test_detector_name : Callable ):
425- unique_name = generate_test_detector_name ()
424+ def test_get_or_create_detector_with_metadata (gl : Groundlight , detector_name : Callable ):
425+ unique_name = detector_name ()
426426 query = "Is there a dog?"
427427 metadata = generate_random_dict (target_size_bytes = 200 )
428428 detector = gl .get_or_create_detector (name = unique_name , query = query , metadata = metadata )
@@ -442,8 +442,8 @@ def test_get_or_create_detector_with_metadata(gl: Groundlight, generate_test_det
442442 ["" ],
443443 ],
444444)
445- def test_create_detector_with_invalid_metadata (gl : Groundlight , metadata_list : Any , generate_test_detector_name : Callable ):
446- name = generate_test_detector_name ()
445+ def test_create_detector_with_invalid_metadata (gl : Groundlight , metadata_list : Any , detector_name : Callable ):
446+ name = detector_name ()
447447 query = "Is there a dog?"
448448
449449 for metadata in metadata_list :
@@ -626,9 +626,9 @@ def test_list_image_queries(gl: Groundlight):
626626 assert is_valid_display_result (image_query .result )
627627
628628
629- def test_list_image_queries_with_filter (gl : Groundlight , generate_test_detector_name : Callable ):
629+ def test_list_image_queries_with_filter (gl : Groundlight , detector_name : Callable ):
630630 # We want a fresh detector so we know exactly what image queries are associated with it
631- detector = gl .create_detector (name = generate_test_detector_name (), query = "Is there a dog?" )
631+ detector = gl .create_detector (name = detector_name (), query = "Is there a dog?" )
632632 image_query_yes = gl .ask_async (detector = detector .id , image = "test/assets/dog.jpeg" , human_review = "NEVER" )
633633 image_query_no = gl .ask_async (detector = detector .id , image = "test/assets/cat.jpeg" , human_review = "NEVER" )
634634 iq_ids = [image_query_yes .id , image_query_no .id ]
@@ -854,33 +854,33 @@ def test_submit_image_query_with_empty_inspection_id(gl: Groundlight, detector:
854854 )
855855
856856
857- def test_binary_detector (gl : Groundlight , generate_test_detector_name : Callable ):
857+ def test_binary_detector (gl : Groundlight , detector_name : Callable ):
858858 """
859859 verify that we can create and submit to a binary detector
860860 """
861- name = generate_test_detector_name ()
861+ name = detector_name ()
862862 created_detector = gl .create_binary_detector (name , "Is there a dog" , confidence_threshold = 0.0 )
863863 assert created_detector is not None
864864 binary_iq = gl .submit_image_query (created_detector , "test/assets/dog.jpeg" )
865865 assert binary_iq .result .label is not None
866866
867867
868- def test_counting_detector (gl : Groundlight , generate_test_detector_name : Callable ):
868+ def test_counting_detector (gl : Groundlight , detector_name : Callable ):
869869 """
870870 verify that we can create and submit to a counting detector
871871 """
872- name = generate_test_detector_name ()
872+ name = detector_name ()
873873 created_detector = gl .create_counting_detector (name , "How many dogs" , "dog" , confidence_threshold = 0.0 )
874874 assert created_detector is not None
875875 count_iq = gl .submit_image_query (created_detector , "test/assets/dog.jpeg" )
876876 assert count_iq .result .count is not None
877877
878878
879- def test_counting_detector_async (gl : Groundlight , generate_test_detector_name : Callable ):
879+ def test_counting_detector_async (gl : Groundlight , detector_name : Callable ):
880880 """
881881 verify that we can create and submit to a counting detector
882882 """
883- name = generate_test_detector_name ()
883+ name = detector_name ()
884884 created_detector = gl .create_counting_detector (name , "How many dogs" , "dog" , confidence_threshold = 0.0 )
885885 assert created_detector is not None
886886 async_iq = gl .ask_async (created_detector , "test/assets/dog.jpeg" )
@@ -895,11 +895,11 @@ def test_counting_detector_async(gl: Groundlight, generate_test_detector_name: C
895895 assert _image_query .result is not None
896896
897897
898- def test_multiclass_detector (gl : Groundlight , generate_test_detector_name : Callable ):
898+ def test_multiclass_detector (gl : Groundlight , detector_name : Callable ):
899899 """
900900 verify that we can create and submit to a multi-class detector
901901 """
902- name = generate_test_detector_name ()
902+ name = detector_name ()
903903 class_names = ["Golden Retriever" , "Labrador Retriever" , "Poodle" ]
904904 created_detector = gl .create_multiclass_detector (
905905 name , "What kind of dog is this?" , class_names = class_names , confidence_threshold = 0.0
@@ -910,12 +910,12 @@ def test_multiclass_detector(gl: Groundlight, generate_test_detector_name: Calla
910910 assert mc_iq .result .label in class_names
911911
912912
913- def test_delete_detector (gl : Groundlight , generate_test_detector_name : Callable ):
913+ def test_delete_detector (gl : Groundlight , detector_name : Callable ):
914914 """
915915 Test deleting a detector by both ID and object, and verify proper error handling.
916916 """
917917 # Create a detector to delete
918- name = generate_test_detector_name ("Test delete detector" )
918+ name = detector_name ("Test delete detector" )
919919 query = "Is there a dog to delete?"
920920 pipeline_config = "never-review"
921921 detector = gl .create_detector (name = name , query = query , pipeline_config = pipeline_config )
@@ -928,7 +928,7 @@ def test_delete_detector(gl: Groundlight, generate_test_detector_name: Callable)
928928 gl .get_detector (detector .id )
929929
930930 # Create another detector to test deletion by ID string and that an attached image query is deleted
931- name2 = generate_test_detector_name ("Test delete detector 2" )
931+ name2 = detector_name ("Test delete detector 2" )
932932 detector2 = gl .create_detector (name = name2 , query = query , pipeline_config = pipeline_config )
933933 gl .submit_image_query (detector2 , "test/assets/dog.jpeg" )
934934
@@ -951,14 +951,14 @@ def test_delete_detector(gl: Groundlight, generate_test_detector_name: Callable)
951951 gl .delete_detector (fake_detector_id ) # type: ignore
952952
953953
954- def test_create_detector_with_invalid_priming_group_id (gl : Groundlight , generate_test_detector_name : Callable ):
954+ def test_create_detector_with_invalid_priming_group_id (gl : Groundlight , detector_name : Callable ):
955955 """
956956 Test that creating a detector with a non-existent priming_group_id returns an appropriate error.
957957
958958 Note: PrimingGroup IDs are provided by Groundlight representatives. If you would like to
959959 use a priming_group_id, please reach out to your Groundlight representative.
960960 """
961- name = generate_test_detector_name ("Test invalid priming" )
961+ name = detector_name ("Test invalid priming" )
962962 query = "Is there a dog?"
963963 pipeline_config = "never-review"
964964 priming_group_id = "prgrp_nonexistent12345678901234567890"
0 commit comments