Skip to content

Commit 624e83d

Browse files
Merge pull request #677 from adamtheturtle/rename-fixture
Rename a fixture to be more clear
2 parents fd5c489 + 9ee1021 commit 624e83d

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

tests/mock_vws/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ def _delete_all_targets(database_keys: VuforiaDatabaseKeys) -> None:
8181

8282
@pytest.fixture()
8383
def target_id(
84-
png_rgb_success: io.BytesIO,
84+
image_file_success_state_low_rating: io.BytesIO,
8585
vuforia_database_keys: VuforiaDatabaseKeys,
8686
) -> str:
8787
"""
8888
Return the target ID of a target in the database.
8989
9090
The target is one which will have a 'success' status when processed.
9191
"""
92-
image_data = png_rgb_success.read()
92+
image_data = image_file_success_state_low_rating.read()
9393
image_data_encoded = base64.b64encode(image_data).decode('ascii')
9494

9595
data = {

tests/mock_vws/fixtures/images.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212

1313
@pytest.fixture
14-
def png_rgb_success() -> io.BytesIO:
14+
def image_file_success_state_low_rating() -> io.BytesIO:
1515
"""
16-
Return a PNG file in the RGB color space which is expected to have a
17-
'success' status when added to a target.
16+
Return an image file which is expected to have a 'success' status when
17+
added to a target and a low rating after processing.
1818
"""
1919
return make_image_file(
2020
file_format='PNG',

tests/mock_vws/test_database_summary.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ def test_failed_images(
193193
def test_inactive_images(
194194
self,
195195
vuforia_database_keys: VuforiaDatabaseKeys,
196-
png_rgb_success: io.BytesIO,
196+
image_file_success_state_low_rating: io.BytesIO,
197197
) -> None:
198198
"""
199199
The number of images with a False active_flag and a 'success' status is
200200
returned.
201201
"""
202-
image_data = png_rgb_success.read()
202+
image_data = image_file_success_state_low_rating.read()
203203
image_data_encoded = base64.b64encode(image_data).decode('ascii')
204204

205205
data = {
@@ -323,12 +323,12 @@ class TestProcessingImages:
323323

324324
def test_processing_images(
325325
self,
326-
png_rgb_success: io.BytesIO,
326+
image_file_success_state_low_rating: io.BytesIO,
327327
) -> None:
328328
"""
329329
The number of images in the processing state is returned.
330330
"""
331-
image_data = png_rgb_success.read()
331+
image_data = image_file_success_state_low_rating.read()
332332
image_data_encoded = base64.b64encode(image_data).decode('ascii')
333333

334334
data = {

tests/mock_vws/test_get_duplicates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_duplicates(
6060
self,
6161
vuforia_database_keys: VuforiaDatabaseKeys,
6262
high_quality_image: io.BytesIO,
63-
png_rgb_success: io.BytesIO,
63+
image_file_success_state_low_rating: io.BytesIO,
6464
) -> None:
6565
"""
6666
Target IDs of similar targets are returned.
@@ -70,7 +70,7 @@ def test_duplicates(
7070
image_data = high_quality_image.read()
7171
image_data_encoded = base64.b64encode(image_data).decode('ascii')
7272

73-
different = png_rgb_success.read()
73+
different = image_file_success_state_low_rating.read()
7474
different_data_encoded = base64.b64encode(different).decode('ascii')
7575

7676
original_data = {

tests/mock_vws/test_get_target.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_fail_status(
204204
def test_success_status(
205205
self,
206206
vuforia_database_keys: VuforiaDatabaseKeys,
207-
png_rgb_success: io.BytesIO,
207+
image_file_success_state_low_rating: io.BytesIO,
208208
) -> None:
209209
"""
210210
When a random, large enough image is given, the status changes from
@@ -214,7 +214,7 @@ def test_success_status(
214214
The test image does not prove that what is counted as a success in the
215215
mock will be counted as a success in the real implementation.
216216
"""
217-
image_data = png_rgb_success.read()
217+
image_data = image_file_success_state_low_rating.read()
218218
image_data_encoded = base64.b64encode(image_data).decode('ascii')
219219

220220
data = {

tests/mock_vws/test_update_target.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,14 @@ class TestActiveFlag:
266266
def test_active_flag(
267267
self,
268268
vuforia_database_keys: VuforiaDatabaseKeys,
269-
png_rgb_success: io.BytesIO,
269+
image_file_success_state_low_rating: io.BytesIO,
270270
initial_active_flag: bool,
271271
desired_active_flag: bool,
272272
) -> None:
273273
"""
274274
Setting the active flag to a Boolean value changes it.
275275
"""
276-
image_data = png_rgb_success.read()
276+
image_data = image_file_success_state_low_rating.read()
277277
image_data_encoded = base64.b64encode(image_data).decode('ascii')
278278

279279
data = {
@@ -582,13 +582,13 @@ def test_name_invalid(
582582

583583
def test_existing_target_name(
584584
self,
585-
png_rgb_success: io.BytesIO,
585+
image_file_success_state_low_rating: io.BytesIO,
586586
vuforia_database_keys: VuforiaDatabaseKeys,
587587
) -> None:
588588
"""
589589
Only one target can have a given name.
590590
"""
591-
image_data = png_rgb_success.read()
591+
image_data = image_file_success_state_low_rating.read()
592592
image_data_encoded = base64.b64encode(image_data).decode('ascii')
593593

594594
first_target_name = 'example_name'
@@ -644,13 +644,13 @@ def test_existing_target_name(
644644

645645
def test_same_name_given(
646646
self,
647-
png_rgb_success: io.BytesIO,
647+
image_file_success_state_low_rating: io.BytesIO,
648648
vuforia_database_keys: VuforiaDatabaseKeys,
649649
) -> None:
650650
"""
651651
Updating a target with its own name does not give an error.
652652
"""
653-
image_data = png_rgb_success.read()
653+
image_data = image_file_success_state_low_rating.read()
654654
image_data_encoded = base64.b64encode(image_data).decode('ascii')
655655

656656
name = 'example'
@@ -964,7 +964,7 @@ def test_invalid_type(
964964

965965
def test_rating_can_change(
966966
self,
967-
png_rgb_success: io.BytesIO,
967+
image_file_success_state_low_rating: io.BytesIO,
968968
high_quality_image: io.BytesIO,
969969
vuforia_database_keys: VuforiaDatabaseKeys,
970970
) -> None:
@@ -976,7 +976,7 @@ def test_rating_can_change(
976976
The mock randomly assigns a quality and makes sure that the new quality
977977
is different to the old quality.
978978
"""
979-
poor_image = png_rgb_success.read()
979+
poor_image = image_file_success_state_low_rating.read()
980980
poor_image_data_encoded = base64.b64encode(poor_image).decode('ascii')
981981

982982
good_image = high_quality_image.read()

0 commit comments

Comments
 (0)