Skip to content

Commit 80f4ea5

Browse files
Merge pull request #674 from adamtheturtle/fewer-image-params
Remove a few unnecessary fixtures
2 parents f4e6ee8 + 83ac1d3 commit 80f4ea5

File tree

1 file changed

+13
-35
lines changed

1 file changed

+13
-35
lines changed

tests/mock_vws/fixtures/images.py

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@ def png_greyscale() -> io.BytesIO:
5050
)
5151

5252

53-
@pytest.fixture
54-
def jpeg_cmyk() -> io.BytesIO:
55-
"""
56-
Return a 1x1 JPEG file in the CMYK color space.
57-
"""
58-
return make_image_file(
59-
file_format='JPEG',
60-
color_space='CMYK',
61-
width=1,
62-
height=1,
63-
)
64-
65-
6653
@pytest.fixture
6754
def jpeg_rgb() -> io.BytesIO:
6855
"""
@@ -76,22 +63,6 @@ def jpeg_rgb() -> io.BytesIO:
7663
)
7764

7865

79-
@pytest.fixture
80-
def tiff_rgb() -> io.BytesIO:
81-
"""
82-
Return a 1x1 TIFF file in the RGB color space.
83-
84-
This is given as an option which is not supported by Vuforia as Vuforia
85-
supports only JPEG and PNG files.
86-
"""
87-
return make_image_file(
88-
file_format='TIFF',
89-
color_space='RGB',
90-
width=1,
91-
height=1,
92-
)
93-
94-
9566
@pytest.fixture(params=['png_rgb', 'jpeg_rgb', 'png_greyscale'])
9667
def image_file(request: SubRequest) -> io.BytesIO:
9768
"""
@@ -104,15 +75,22 @@ def image_file(request: SubRequest) -> io.BytesIO:
10475
return file_bytes_io
10576

10677

107-
@pytest.fixture(params=['tiff_rgb', 'jpeg_cmyk'])
78+
@pytest.fixture(
79+
params=[('TIFF', 'RGB'), ('JPEG', 'CMYK')],
80+
ids=['Not accepted format', 'Not accepted color space'],
81+
)
10882
def bad_image_file(request: SubRequest) -> io.BytesIO:
10983
"""
110-
Return an image file which is expected to work on Vuforia which is
111-
expected to cause a `BadImage` result when an attempt is made to add it to
112-
the target database.
84+
Return an image file which is expected to cause a `BadImage` result when an
85+
attempt is made to add it to the target database.
11386
"""
114-
file_bytes_io: io.BytesIO = request.getfixturevalue(request.param)
115-
return file_bytes_io
87+
file_format, color_space = request.param
88+
return make_image_file(
89+
file_format=file_format,
90+
color_space=color_space,
91+
width=1,
92+
height=1,
93+
)
11694

11795

11896
@pytest.fixture()

0 commit comments

Comments
 (0)