Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ optional-dependencies.dev = [
"vale==3.13.0.0",
"vulture==2.16",
"vws-python-mock==2026.8.14",
"vws-test-fixtures==2026.8.16",
"vws-test-fixtures==2026.8.23",
"yamlfix==1.19.1",
"zizmor==1.29.0",
]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_async_cloud_reco_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def test_too_many_max_results(
async def test_image_too_large(
*,
async_cloud_reco_client: AsyncCloudRecoService,
png_too_large: io.BytesIO | io.BufferedRandom,
jpeg_too_large: io.BytesIO | io.BufferedRandom,
) -> None:
"""A ``RequestEntityTooLarge`` exception is raised if an
image which is too large is given.
Expand All @@ -62,7 +62,7 @@ async def test_image_too_large(
expected_exception=RequestEntityTooLargeError,
) as exc:
await async_cloud_reco_client.query(
image=png_too_large,
image=jpeg_too_large,
)

assert (
Expand Down
10 changes: 9 additions & 1 deletion tests/test_async_vws_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for VWS exceptions raised from async clients."""

import base64
import io
import uuid
from http import HTTPStatus
Expand Down Expand Up @@ -312,10 +313,17 @@ async def test_metadata_too_large(
*,
async_vws_client: AsyncVWS,
high_quality_image: io.BytesIO,
application_metadata_near_size_limit: str,
) -> None:
"""A ``MetadataTooLarge`` exception is raised if the metadata
given is too large.
"""
decoded_metadata = base64.b64decode(
s=application_metadata_near_size_limit.encode(encoding="ascii"),
)
over_limit_metadata = base64.b64encode(
s=decoded_metadata + b"x",
).decode(encoding="ascii")
with pytest.raises(
expected_exception=MetadataTooLargeError,
) as exc:
Expand All @@ -324,7 +332,7 @@ async def test_metadata_too_large(
width=1,
image=high_quality_image,
active_flag=True,
application_metadata="a" * 1024 * 1024 * 10,
application_metadata=over_limit_metadata,
)

assert exc.value.response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cloud_reco_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def test_too_many_max_results(
def test_image_too_large(
*,
cloud_reco_client: CloudRecoService,
png_too_large: io.BytesIO | io.BufferedRandom,
jpeg_too_large: io.BytesIO | io.BufferedRandom,
) -> None:
"""
A ``RequestEntityTooLarge`` exception is raised if an image which is
too
large is given.
"""
with pytest.raises(expected_exception=RequestEntityTooLargeError) as exc:
cloud_reco_client.query(image=png_too_large)
cloud_reco_client.query(image=jpeg_too_large)

assert (
exc.value.response.status_code == HTTPStatus.REQUEST_ENTITY_TOO_LARGE
Expand Down
10 changes: 9 additions & 1 deletion tests/test_vws_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for VWS exceptions."""

import base64
import io
import uuid
from http import HTTPStatus
Expand Down Expand Up @@ -297,19 +298,26 @@ def test_metadata_too_large(
*,
vws_client: VWS,
high_quality_image: io.BytesIO,
application_metadata_near_size_limit: str,
) -> None:
"""
A ``MetadataTooLarge`` exception is raised if the metadata given is
too
large.
"""
decoded_metadata = base64.b64decode(
s=application_metadata_near_size_limit.encode(encoding="ascii"),
)
over_limit_metadata = base64.b64encode(
s=decoded_metadata + b"x",
).decode(encoding="ascii")
with pytest.raises(expected_exception=MetadataTooLargeError) as exc:
vws_client.add_target(
name="x",
width=1,
image=high_quality_image,
active_flag=True,
application_metadata="a" * 1024 * 1024 * 10,
application_metadata=over_limit_metadata,
)

assert exc.value.response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
Expand Down
Loading