@@ -60,7 +60,7 @@ def _make_image_file(
6060 return image_buffer
6161
6262
63- def test_image_too_large (client : VWS ) -> None :
63+ def test_image_too_large (vws_client : VWS ) -> None :
6464 """
6565 When giving an image which is too large, an ``ImageTooLarge`` exception is
6666 raised.
@@ -75,18 +75,18 @@ def test_image_too_large(client: VWS) -> None:
7575 )
7676
7777 with pytest .raises (ImageTooLarge ) as exc :
78- client .add_target (name = 'x' , width = 1 , image = png_too_large )
78+ vws_client .add_target (name = 'x' , width = 1 , image = png_too_large )
7979
8080 assert exc .value .response .status_code == codes .UNPROCESSABLE_ENTITY
8181
8282
83- def test_invalid_given_id (client : VWS ) -> None :
83+ def test_invalid_given_id (vws_client : VWS ) -> None :
8484 """
8585 Giving an invalid ID to a helper which requires a target ID to be given
8686 causes an ``UnknownTarget`` exception to be raised.
8787 """
8888 with pytest .raises (UnknownTarget ) as exc :
89- client .delete_target (target_id = 'x' )
89+ vws_client .delete_target (target_id = 'x' )
9090 assert exc .value .response .status_code == codes .NOT_FOUND
9191
9292
@@ -102,13 +102,13 @@ def test_fail(high_quality_image: io.BytesIO) -> None:
102102 A ``Fail`` exception is raised when the server access key does not exist.
103103 """
104104 with MockVWS ():
105- client = VWS (
105+ vws_client = VWS (
106106 server_access_key = 'a' ,
107107 server_secret_key = 'a' ,
108108 )
109109
110110 with pytest .raises (Fail ) as exc :
111- client .add_target (
111+ vws_client .add_target (
112112 name = 'x' ,
113113 width = 1 ,
114114 image = high_quality_image ,
@@ -117,47 +117,50 @@ def test_fail(high_quality_image: io.BytesIO) -> None:
117117 assert exc .value .response .status_code == codes .BAD_REQUEST
118118
119119
120- def test_bad_image (client : VWS ) -> None :
120+ def test_bad_image (vws_client : VWS ) -> None :
121121 """
122122 A ``BadImage`` exception is raised when a non-image is given.
123123 """
124124 not_an_image = io .BytesIO (b'Not an image' )
125125 with pytest .raises (BadImage ) as exc :
126- client .add_target (name = 'x' , width = 1 , image = not_an_image )
126+ vws_client .add_target (name = 'x' , width = 1 , image = not_an_image )
127127
128128 assert exc .value .response .status_code == codes .UNPROCESSABLE_ENTITY
129129
130130
131131def test_target_name_exist (
132- client : VWS ,
132+ vws_client : VWS ,
133133 high_quality_image : io .BytesIO ,
134134) -> None :
135135 """
136136 A ``TargetNameExist`` exception is raised after adding two targets with
137137 the same name.
138138 """
139- client .add_target (name = 'x' , width = 1 , image = high_quality_image )
139+ vws_client .add_target (name = 'x' , width = 1 , image = high_quality_image )
140140 with pytest .raises (TargetNameExist ) as exc :
141- client .add_target (name = 'x' , width = 1 , image = high_quality_image )
141+ vws_client .add_target (name = 'x' , width = 1 , image = high_quality_image )
142142
143143 assert exc .value .response .status_code == codes .FORBIDDEN
144144
145145
146- def test_project_inactive (client : VWS , high_quality_image : io .BytesIO ) -> None :
146+ def test_project_inactive (
147+ vws_client : VWS ,
148+ high_quality_image : io .BytesIO ,
149+ ) -> None :
147150 """
148151 A ``ProjectInactive`` exception is raised if adding a target to an
149152 inactive database.
150153 """
151154 database = VuforiaDatabase (state = States .PROJECT_INACTIVE )
152155 with MockVWS () as mock :
153156 mock .add_database (database = database )
154- client = VWS (
157+ vws_client = VWS (
155158 server_access_key = database .server_access_key ,
156159 server_secret_key = database .server_secret_key ,
157160 )
158161
159162 with pytest .raises (ProjectInactive ) as exc :
160- client .add_target (
163+ vws_client .add_target (
161164 name = 'x' ,
162165 width = 1 ,
163166 image = high_quality_image ,
@@ -167,35 +170,35 @@ def test_project_inactive(client: VWS, high_quality_image: io.BytesIO) -> None:
167170
168171
169172def test_target_status_processing (
170- client : VWS ,
173+ vws_client : VWS ,
171174 high_quality_image : io .BytesIO ,
172175) -> None :
173176 """
174177 A ``TargetStatusProcessing`` exception is raised if trying to delete a
175178 target which is processing.
176179 """
177- target_id = client .add_target (
180+ target_id = vws_client .add_target (
178181 name = 'x' ,
179182 width = 1 ,
180183 image = high_quality_image ,
181184 )
182185
183186 with pytest .raises (TargetStatusProcessing ) as exc :
184- client .delete_target (target_id = target_id )
187+ vws_client .delete_target (target_id = target_id )
185188
186189 assert exc .value .response .status_code == codes .FORBIDDEN
187190
188191
189192def test_metadata_too_large (
190- client : VWS ,
193+ vws_client : VWS ,
191194 high_quality_image : io .BytesIO ,
192195) -> None :
193196 """
194197 A ``MetadataTooLarge`` exception is raised if the metadata given is too
195198 large.
196199 """
197200 with pytest .raises (MetadataTooLarge ) as exc :
198- client .add_target (
201+ vws_client .add_target (
199202 name = 'x' ,
200203 width = 1 ,
201204 image = high_quality_image ,
@@ -213,13 +216,13 @@ def test_authentication_failure(high_quality_image: io.BytesIO) -> None:
213216 database = VuforiaDatabase ()
214217 with MockVWS () as mock :
215218 mock .add_database (database = database )
216- client = VWS (
219+ vws_client = VWS (
217220 server_access_key = database .server_access_key ,
218221 server_secret_key = 'a' ,
219222 )
220223
221224 with pytest .raises (AuthenticationFailure ) as exc :
222- client .add_target (
225+ vws_client .add_target (
223226 name = 'x' ,
224227 width = 1 ,
225228 image = high_quality_image ,
@@ -229,20 +232,20 @@ def test_authentication_failure(high_quality_image: io.BytesIO) -> None:
229232
230233
231234def test_target_status_not_success (
232- client : VWS ,
235+ vws_client : VWS ,
233236 high_quality_image : io .BytesIO ,
234237) -> None :
235238 """
236239 A ``TargetStatusNotSuccess`` exception is raised when updating a target
237240 which has a status which is not "Success".
238241 """
239- target_id = client .add_target (
242+ target_id = vws_client .add_target (
240243 name = 'x' ,
241244 width = 1 ,
242245 image = high_quality_image ,
243246 )
244247
245248 with pytest .raises (TargetStatusNotSuccess ) as exc :
246- client .update_target (target_id = target_id )
249+ vws_client .update_target (target_id = target_id )
247250
248251 assert exc .value .response .status_code == codes .FORBIDDEN
0 commit comments