Skip to content

Commit c3dd1f2

Browse files
committed
More thorough test passing on real
1 parent 2b87cf5 commit c3dd1f2

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

spelling_private_dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ kwargs
3131
linters
3232
mb
3333
metadata
34+
mib
3435
mockvws
3536
multipart
3637
noqa

tests/mock_vws/test_query.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ def test_png(
10791079
We do not test exactly at this limit, but that may be beneficial in the
10801080
future.
10811081
"""
1082-
documented_max_bytes = 2 * 1024 * 1024
1082+
max_bytes = 2 * 1024 * 1024
10831083
width = height = 835
10841084
png_not_too_large = make_image_file(
10851085
file_format='PNG',
@@ -1096,8 +1096,8 @@ def test_png(
10961096
# maximum file size.
10971097
#
10981098
# This is just because of the implementation details of ``image_file``.
1099-
assert image_content_size < documented_max_bytes
1100-
assert (image_content_size * 1.05) > documented_max_bytes
1099+
assert image_content_size < max_bytes
1100+
assert (image_content_size * 1.05) > max_bytes
11011101

11021102
response = query(
11031103
vuforia_database_keys=vuforia_database_keys,
@@ -1122,8 +1122,8 @@ def test_png(
11221122
# maximum file size.
11231123
#
11241124
# This is just because of the implementation details of ``image_file``.
1125-
assert image_content_size > documented_max_bytes
1126-
assert (image_content_size * 0.95) < documented_max_bytes
1125+
assert image_content_size > max_bytes
1126+
assert (image_content_size * 0.95) < max_bytes
11271127

11281128
with pytest.raises(requests.exceptions.ConnectionError):
11291129
query(
@@ -1139,12 +1139,13 @@ def test_jpeg(
11391139
According to
11401140
https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query.
11411141
the maximum file size is "512 KiB for JPEG".
1142+
However, this test shows that the maximum size for JPEG is 2 MiB.
11421143
11431144
Above this limit, a ``ConnectionError`` is raised.
11441145
We do not test exactly at this limit, but that may be beneficial in the
11451146
future.
11461147
"""
1147-
# documented_max_bytes = 512 * 1024
1148+
max_bytes = 2 * 1024 * 1024
11481149
width = height = 1864
11491150
png_not_too_large = make_image_file(
11501151
file_format='JPEG',
@@ -1156,14 +1157,14 @@ def test_jpeg(
11561157
image_content = png_not_too_large.getvalue()
11571158
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
11581159

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
1160+
image_content_size = len(image_content)
1161+
# We check that the image we created is just slightly smaller than the
1162+
# maximum file size.
11661163
#
1164+
# This is just because of the implementation details of ``image_file``.
1165+
assert image_content_size < max_bytes
1166+
assert (image_content_size * 1.05) > max_bytes
1167+
11671168
response = query(
11681169
vuforia_database_keys=vuforia_database_keys,
11691170
body=body,
@@ -1182,13 +1183,13 @@ def test_jpeg(
11821183

11831184
image_content = png_not_too_large.getvalue()
11841185
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
1185-
# image_content_size = len(image_content)
1186+
image_content_size = len(image_content)
11861187
# We check that the image we created is just slightly larger than the
11871188
# maximum file size.
11881189
#
11891190
# 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
1191+
assert image_content_size > max_bytes
1192+
assert (image_content_size * 0.95) < max_bytes
11921193

11931194
with pytest.raises(requests.exceptions.ConnectionError):
11941195
query(

0 commit comments

Comments
 (0)