File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ optional-dependencies.dev = [
8787 " vale==3.13.0.0" ,
8888 " vulture==2.16" ,
8989 " vws-python-mock==2026.8.14" ,
90- " vws-test-fixtures==2026.8.16 " ,
90+ " vws-test-fixtures==2026.8.23 " ,
9191 " yamlfix==1.19.1" ,
9292 " zizmor==1.29.0" ,
9393]
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ async def test_too_many_max_results(
5353async def test_image_too_large (
5454 * ,
5555 async_cloud_reco_client : AsyncCloudRecoService ,
56- png_too_large : io .BytesIO | io .BufferedRandom ,
56+ jpeg_too_large : io .BytesIO | io .BufferedRandom ,
5757) -> None :
5858 """A ``RequestEntityTooLarge`` exception is raised if an
5959 image which is too large is given.
@@ -62,7 +62,7 @@ async def test_image_too_large(
6262 expected_exception = RequestEntityTooLargeError ,
6363 ) as exc :
6464 await async_cloud_reco_client .query (
65- image = png_too_large ,
65+ image = jpeg_too_large ,
6666 )
6767
6868 assert (
Original file line number Diff line number Diff line change 11"""Tests for VWS exceptions raised from async clients."""
22
3+ import base64
34import io
45import uuid
56from http import HTTPStatus
@@ -312,10 +313,17 @@ async def test_metadata_too_large(
312313 * ,
313314 async_vws_client : AsyncVWS ,
314315 high_quality_image : io .BytesIO ,
316+ application_metadata_near_size_limit : str ,
315317) -> None :
316318 """A ``MetadataTooLarge`` exception is raised if the metadata
317319 given is too large.
318320 """
321+ decoded_metadata = base64 .b64decode (
322+ s = application_metadata_near_size_limit .encode (encoding = "ascii" ),
323+ )
324+ over_limit_metadata = base64 .b64encode (
325+ s = decoded_metadata + b"x" ,
326+ ).decode (encoding = "ascii" )
319327 with pytest .raises (
320328 expected_exception = MetadataTooLargeError ,
321329 ) as exc :
@@ -324,7 +332,7 @@ async def test_metadata_too_large(
324332 width = 1 ,
325333 image = high_quality_image ,
326334 active_flag = True ,
327- application_metadata = "a" * 1024 * 1024 * 10 ,
335+ application_metadata = over_limit_metadata ,
328336 )
329337
330338 assert exc .value .response .status_code == HTTPStatus .UNPROCESSABLE_ENTITY
Original file line number Diff line number Diff line change @@ -49,15 +49,15 @@ def test_too_many_max_results(
4949def test_image_too_large (
5050 * ,
5151 cloud_reco_client : CloudRecoService ,
52- png_too_large : io .BytesIO | io .BufferedRandom ,
52+ jpeg_too_large : io .BytesIO | io .BufferedRandom ,
5353) -> None :
5454 """
5555 A ``RequestEntityTooLarge`` exception is raised if an image which is
5656 too
5757 large is given.
5858 """
5959 with pytest .raises (expected_exception = RequestEntityTooLargeError ) as exc :
60- cloud_reco_client .query (image = png_too_large )
60+ cloud_reco_client .query (image = jpeg_too_large )
6161
6262 assert (
6363 exc .value .response .status_code == HTTPStatus .REQUEST_ENTITY_TOO_LARGE
Original file line number Diff line number Diff line change 11"""Tests for VWS exceptions."""
22
3+ import base64
34import io
45import uuid
56from http import HTTPStatus
@@ -297,19 +298,26 @@ def test_metadata_too_large(
297298 * ,
298299 vws_client : VWS ,
299300 high_quality_image : io .BytesIO ,
301+ application_metadata_near_size_limit : str ,
300302) -> None :
301303 """
302304 A ``MetadataTooLarge`` exception is raised if the metadata given is
303305 too
304306 large.
305307 """
308+ decoded_metadata = base64 .b64decode (
309+ s = application_metadata_near_size_limit .encode (encoding = "ascii" ),
310+ )
311+ over_limit_metadata = base64 .b64encode (
312+ s = decoded_metadata + b"x" ,
313+ ).decode (encoding = "ascii" )
306314 with pytest .raises (expected_exception = MetadataTooLargeError ) as exc :
307315 vws_client .add_target (
308316 name = "x" ,
309317 width = 1 ,
310318 image = high_quality_image ,
311319 active_flag = True ,
312- application_metadata = "a" * 1024 * 1024 * 10 ,
320+ application_metadata = over_limit_metadata ,
313321 )
314322
315323 assert exc .value .response .status_code == HTTPStatus .UNPROCESSABLE_ENTITY
You can’t perform that action at this time.
0 commit comments