Skip to content

Commit 2b87cf5

Browse files
committed
Narrow down max jpeg file size
1 parent 681146b commit 2b87cf5

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/mock_vws/test_query.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,8 +1144,8 @@ def test_jpeg(
11441144
We do not test exactly at this limit, but that may be beneficial in the
11451145
future.
11461146
"""
1147-
documented_max_bytes = 512 * 1024
1148-
width = height = 929
1147+
# documented_max_bytes = 512 * 1024
1148+
width = height = 1864
11491149
png_not_too_large = make_image_file(
11501150
file_format='JPEG',
11511151
color_space='RGB',
@@ -1156,14 +1156,14 @@ def test_jpeg(
11561156
image_content = png_not_too_large.getvalue()
11571157
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
11581158

1159-
image_content_size = len(image_content)
1160-
# We check that the image we created is just slightly smaller than the
1161-
# maximum file size.
1159+
# image_content_size = len(image_content)
1160+
# # We check that the image we created is just slightly smaller than the
1161+
# # maximum file size.
1162+
# #
1163+
# # This is just because of the implementation details of ``image_file``.
1164+
# assert image_content_size < documented_max_bytes
1165+
# assert (image_content_size * 1.05) > documented_max_bytes
11621166
#
1163-
# This is just because of the implementation details of ``image_file``.
1164-
assert image_content_size < documented_max_bytes
1165-
assert (image_content_size * 1.05) > documented_max_bytes
1166-
11671167
response = query(
11681168
vuforia_database_keys=vuforia_database_keys,
11691169
body=body,
@@ -1172,7 +1172,7 @@ def test_jpeg(
11721172
assert_query_success(response=response)
11731173
assert response.json()['results'] == []
11741174

1175-
width = height = 930
1175+
width = height = 1865
11761176
png_not_too_large = make_image_file(
11771177
file_format='JPEG',
11781178
color_space='RGB',
@@ -1182,13 +1182,13 @@ def test_jpeg(
11821182

11831183
image_content = png_not_too_large.getvalue()
11841184
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
1185-
image_content_size = len(image_content)
1185+
# image_content_size = len(image_content)
11861186
# We check that the image we created is just slightly larger than the
11871187
# maximum file size.
11881188
#
11891189
# This is just because of the implementation details of ``image_file``.
1190-
assert image_content_size > documented_max_bytes
1191-
assert (image_content_size * 0.95) < documented_max_bytes
1190+
# assert image_content_size > documented_max_bytes
1191+
# assert (image_content_size * 0.95) < documented_max_bytes
11921192

11931193
with pytest.raises(requests.exceptions.ConnectionError):
11941194
query(

0 commit comments

Comments
 (0)