Skip to content

Commit f57a025

Browse files
Merge pull request #836 from adamtheturtle/parametrize-metadata-tests
Parametrize metadata test
2 parents e9e0c01 + 08da4f5 commit f57a025

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

tests/test_add_target.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import io
6+
from typing import Optional
67

78
import pytest
89
from mock_vws import MockVWS
@@ -79,30 +80,21 @@ class TestApplicationMetadata:
7980
Tests for the ``application_metadata`` parameter to ``add_target``.
8081
"""
8182

82-
def test_none(self, client: VWS, high_quality_image: io.BytesIO) -> None:
83-
"""
84-
No exception is raised when ``None`` is given.
85-
"""
86-
client.add_target(
87-
name='x',
88-
width=1,
89-
image=high_quality_image,
90-
application_metadata=None,
91-
)
92-
93-
def test_given(
83+
@pytest.mark.parametrize('application_metadata', [None, b'a'])
84+
def test_valid_metadata(
9485
self,
9586
client: VWS,
9687
high_quality_image: io.BytesIO,
88+
application_metadata: Optional[bytes],
9789
) -> None:
9890
"""
99-
No exception is raised when bytes are given.
91+
No exception is raised when ``None`` or bytes is given.
10092
"""
10193
client.add_target(
10294
name='x',
10395
width=1,
10496
image=high_quality_image,
105-
application_metadata=b'a',
97+
application_metadata=application_metadata,
10698
)
10799

108100

@@ -112,7 +104,7 @@ class TestActiveFlag:
112104
"""
113105

114106
@pytest.mark.parametrize('active_flag', [True, False])
115-
def test_given(
107+
def test_active_flag_given(
116108
self,
117109
client: VWS,
118110
high_quality_image: io.BytesIO,

0 commit comments

Comments
 (0)