Skip to content

Commit a36398e

Browse files
committed
Passing test on mock
1 parent c3dd1f2 commit a36398e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/mock_vws/_mock_web_query_api.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,12 @@ def validate_image_file_size(
105105

106106
[image] = parsed['image']
107107

108-
image_file = io.BytesIO(image)
109-
pil_image = Image.open(image_file)
110-
111-
if pil_image.format != 'PNG':
112-
return wrapped(*args, **kwargs)
113-
114-
documented_max_png_bytes = 2 * 1024 * 1024
115-
if len(image) > documented_max_png_bytes:
108+
# This is the documented maximum size of a PNG as per.
109+
# https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query.
110+
# However, the tests show that this maximum size also applies to JPEG
111+
# files.
112+
max_bytes = 2 * 1024 * 1024
113+
if len(image) > max_bytes:
116114
raise requests.exceptions.ConnectionError
117115
return wrapped(*args, **kwargs)
118116

0 commit comments

Comments
 (0)