@@ -47,9 +47,7 @@ def setUp(self):
4747 self .version_id = f"{ self .workspace } /{ self .dataset_id } /{ self .version } "
4848
4949 def test_init_sets_attributes (self ):
50- instance = ObjectDetectionModel (
51- self .api_key , self .version_id , version = self .version
52- )
50+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
5351
5452 self .assertEqual (instance .id , self .version_id )
5553 # self.assertEqual(instance.api_url,
@@ -59,9 +57,7 @@ def test_init_sets_attributes(self):
5957 def test_predict_returns_prediction_group (self ):
6058 print (self .api_url )
6159 image_path = "tests/images/rabbit.JPG"
62- instance = ObjectDetectionModel (
63- self .api_key , self .version_id , version = self .version
64- )
60+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
6561
6662 responses .add (responses .POST , self .api_url , json = MOCK_RESPONSE )
6763
@@ -72,9 +68,7 @@ def test_predict_returns_prediction_group(self):
7268 @responses .activate
7369 def test_predict_with_local_image_request (self ):
7470 image_path = "tests/images/rabbit.JPG"
75- instance = ObjectDetectionModel (
76- self .api_key , self .version_id , version = self .version
77- )
71+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
7872
7973 responses .add (responses .POST , self .api_url , json = MOCK_RESPONSE )
8074
@@ -90,9 +84,7 @@ def test_predict_with_local_image_request(self):
9084 @responses .activate
9185 def test_predict_with_a_numpy_array_request (self ):
9286 np_array = np .ones ((100 , 100 , 1 ), dtype = np .uint8 )
93- instance = ObjectDetectionModel (
94- self .api_key , self .version_id , version = self .version
95- )
87+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
9688
9789 responses .add (responses .POST , self .api_url , json = MOCK_RESPONSE )
9890
@@ -107,9 +99,7 @@ def test_predict_with_a_numpy_array_request(self):
10799
108100 def test_predict_with_local_wrong_image_request (self ):
109101 image_path = "tests/images/not_an_image.txt"
110- instance = ObjectDetectionModel (
111- self .api_key , self .version_id , version = self .version
112- )
102+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
113103 self .assertRaises (UnidentifiedImageError , instance .predict , image_path )
114104
115105 @responses .activate
@@ -119,9 +109,7 @@ def test_predict_with_hosted_image_request(self):
119109 ** self ._default_params ,
120110 "image" : image_path ,
121111 }
122- instance = ObjectDetectionModel (
123- self .api_key , self .version_id , version = self .version
124- )
112+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
125113
126114 # Mock the library validating that the URL is valid before sending to the API
127115 responses .add (responses .POST , self .api_url , json = MOCK_RESPONSE )
@@ -140,9 +128,7 @@ def test_predict_with_confidence_request(self):
140128 confidence = "100"
141129 image_path = "tests/images/rabbit.JPG"
142130 expected_params = {** self ._default_params , "confidence" : confidence }
143- instance = ObjectDetectionModel (
144- self .api_key , self .version_id , version = self .version
145- )
131+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
146132
147133 responses .add (responses .POST , self .api_url , json = MOCK_RESPONSE )
148134
@@ -160,9 +146,7 @@ def test_predict_with_non_200_response_raises_http_error(self):
160146 image_path = "tests/images/rabbit.JPG"
161147 responses .add (responses .POST , self .api_url , status = 403 )
162148
163- instance = ObjectDetectionModel (
164- self .api_key , self .version_id , version = self .version
165- )
149+ instance = ObjectDetectionModel (self .api_key , self .version_id , version = self .version )
166150
167151 with self .assertRaises (HTTPError ):
168152 instance .predict (image_path )
0 commit comments