@@ -678,27 +678,29 @@ def test_search_with_annotation_job_params(self):
678678 {"id" : "image2" , "name" : "test2.jpg" , "created" : 1616161617 , "labels" : ["car" ]},
679679 ]
680680 }
681-
681+
682682 responses .add (
683683 responses .POST ,
684684 expected_url ,
685685 json = mock_response ,
686686 status = 200 ,
687687 match = [
688- json_params_matcher ({
689- "offset" : 0 ,
690- "limit" : 100 ,
691- "batch" : False ,
692- "annotation_job" : True ,
693- "fields" : ["id" , "created" , "name" , "labels" ],
694- })
688+ json_params_matcher (
689+ {
690+ "offset" : 0 ,
691+ "limit" : 100 ,
692+ "batch" : False ,
693+ "annotation_job" : True ,
694+ "fields" : ["id" , "created" , "name" , "labels" ],
695+ }
696+ )
695697 ],
696698 )
697-
699+
698700 results = self .project .search (annotation_job = True )
699701 self .assertEqual (len (results ), 2 )
700702 self .assertEqual (results [0 ]["id" ], "image1" )
701-
703+
702704 # Test 2: Search with annotation_job_id
703705 test_job_id = "job_123456"
704706 responses .add (
@@ -707,64 +709,65 @@ def test_search_with_annotation_job_params(self):
707709 json = mock_response ,
708710 status = 200 ,
709711 match = [
710- json_params_matcher ({
711- "offset" : 0 ,
712- "limit" : 100 ,
713- "batch" : False ,
714- "annotation_job_id" : test_job_id ,
715- "fields" : ["id" , "created" , "name" , "labels" ],
716- })
712+ json_params_matcher (
713+ {
714+ "offset" : 0 ,
715+ "limit" : 100 ,
716+ "batch" : False ,
717+ "annotation_job_id" : test_job_id ,
718+ "fields" : ["id" , "created" , "name" , "labels" ],
719+ }
720+ )
717721 ],
718722 )
719-
723+
720724 results = self .project .search (annotation_job_id = test_job_id )
721725 self .assertEqual (len (results ), 2 )
722-
726+
723727 # Test 3: Search with both parameters
724728 responses .add (
725729 responses .POST ,
726730 expected_url ,
727731 json = mock_response ,
728732 status = 200 ,
729733 match = [
730- json_params_matcher ({
731- "offset" : 0 ,
732- "limit" : 50 ,
733- "batch" : False ,
734- "annotation_job" : False ,
735- "annotation_job_id" : test_job_id ,
736- "prompt" : "dog" ,
737- "fields" : ["id" , "created" , "name" , "labels" ],
738- })
734+ json_params_matcher (
735+ {
736+ "offset" : 0 ,
737+ "limit" : 50 ,
738+ "batch" : False ,
739+ "annotation_job" : False ,
740+ "annotation_job_id" : test_job_id ,
741+ "prompt" : "dog" ,
742+ "fields" : ["id" , "created" , "name" , "labels" ],
743+ }
744+ )
739745 ],
740746 )
741-
742- results = self .project .search (
743- prompt = "dog" ,
744- annotation_job = False ,
745- annotation_job_id = test_job_id ,
746- limit = 50
747- )
747+
748+ results = self .project .search (prompt = "dog" , annotation_job = False , annotation_job_id = test_job_id , limit = 50 )
748749 self .assertEqual (len (results ), 2 )
749-
750+
750751 # Test 4: Verify parameters are not included when None
751752 responses .add (
752753 responses .POST ,
753754 expected_url ,
754755 json = mock_response ,
755756 status = 200 ,
756757 match = [
757- json_params_matcher ({
758- "offset" : 0 ,
759- "limit" : 100 ,
760- "batch" : False ,
761- "fields" : ["id" , "created" , "name" , "labels" ],
762- # annotation_job and annotation_job_id should NOT be in the payload
763- })
758+ json_params_matcher (
759+ {
760+ "offset" : 0 ,
761+ "limit" : 100 ,
762+ "batch" : False ,
763+ "fields" : ["id" , "created" , "name" , "labels" ],
764+ # annotation_job and annotation_job_id should NOT be in the payload
765+ }
766+ )
764767 ],
765768 )
766-
767- # This should pass because json_params_matcher only checks that the
769+
770+ # This should pass because json_params_matcher only checks that the
768771 # specified keys match, it doesn't fail if additional keys are missing
769772 results = self .project .search ()
770773 self .assertEqual (len (results ), 2 )
0 commit comments