Skip to content

Commit 8dff6eb

Browse files
committed
Use clearer fixture name [skip ci]
1 parent 80f4ea5 commit 8dff6eb

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

tests/mock_vws/fixtures/images.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,22 @@ def png_greyscale() -> io.BytesIO:
5050
)
5151

5252

53-
@pytest.fixture
54-
def jpeg_rgb() -> io.BytesIO:
53+
@pytest.fixture(params=[('PNG', 'RGB'), ('JPEG', 'RGB'), ('PNG', 'L')])
54+
def image_files_failed_state(request: SubRequest) -> io.BytesIO:
5555
"""
56-
Return a 1x1 JPEG file in the RGB color space.
56+
Return an image file which is expected to be accepted by the add and
57+
update target endpoints, but get a "failed" status.
5758
"""
59+
# These images get a "failed" status because they are so small.
60+
file_format, color_space = request.param
5861
return make_image_file(
59-
file_format='JPEG',
60-
color_space='RGB',
62+
file_format=file_format,
63+
color_space=color_space,
6164
width=1,
6265
height=1,
6366
)
6467

6568

66-
@pytest.fixture(params=['png_rgb', 'jpeg_rgb', 'png_greyscale'])
67-
def image_file(request: SubRequest) -> io.BytesIO:
68-
"""
69-
Return an image file which is expected to work on Vuforia.
70-
71-
"work" means that this will be added as a target. However, this may or may
72-
not result in target with a 'success' status.
73-
"""
74-
file_bytes_io: io.BytesIO = request.getfixturevalue(request.param)
75-
return file_bytes_io
76-
77-
7869
@pytest.fixture(
7970
params=[('TIFF', 'RGB'), ('JPEG', 'CMYK')],
8071
ids=['Not accepted format', 'Not accepted color space'],

tests/mock_vws/test_add_target.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,12 @@ class TestImage:
385385
def test_image_valid(
386386
self,
387387
vuforia_database_keys: VuforiaDatabaseKeys,
388-
image_file: io.BytesIO,
388+
image_files_failed_state: io.BytesIO,
389389
) -> None:
390390
"""
391-
JPEG and PNG files in the RGB and greyscale color spaces are
392-
allowed.
391+
JPEG and PNG files in the RGB and greyscale color spaces are allowed.
393392
"""
393+
image_file = image_files_failed_state
394394
image_data = image_file.read()
395395
image_data_encoded = base64.b64encode(image_data).decode('ascii')
396396

tests/mock_vws/test_update_target.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,13 @@ class TestImage:
705705
def test_image_valid(
706706
self,
707707
vuforia_database_keys: VuforiaDatabaseKeys,
708-
image_file: io.BytesIO,
708+
image_files_failed_state: io.BytesIO,
709709
target_id: str,
710710
) -> None:
711711
"""
712-
JPEG and PNG files in the RGB and greyscale color spaces are
713-
allowed. The image must be under a threshold.
712+
JPEG and PNG files in the RGB and greyscale color spaces are allowed.
714713
"""
714+
image_file = image_files_failed_state
715715
image_data = image_file.read()
716716
image_data_encoded = base64.b64encode(image_data).decode('ascii')
717717

0 commit comments

Comments
 (0)