Skip to content

Commit 06f4118

Browse files
authored
test_util: Implement test for compat_tool_available (#543)
1 parent a8532a7 commit 06f4118

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

tests/test_util.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,57 @@ def test_is_gitlab_instance(url: str, is_gitlab_api: bool) -> None:
205205
result: bool = is_gitlab_instance(url)
206206

207207
assert result == is_gitlab_api
208+
209+
210+
@pytest.mark.parametrize(
211+
'compat_tool_name, ctobjs, expected', [
212+
pytest.param(
213+
'GE-Proton9-27',
214+
[
215+
{ 'name': 'Luxtorpeda' },
216+
{ 'name': 'GE-Proton8-16' },
217+
{ 'name': 'GE-Proton9-27' },
218+
{ 'name': 'Proton-GE-5-2' },
219+
{ 'name': 'Proton-tkg.10.6.a34b12f' }
220+
],
221+
True,
222+
id = 'GE-Proton9-27 should be found'
223+
),
224+
pytest.param(
225+
'Wine-tkg',
226+
[
227+
{ 'name': 'Luxtorpeda' },
228+
{ 'name': 'GE-Proton8-16' },
229+
{ 'name': 'GE-Proton9-27' },
230+
{ 'name': 'Proton-GE-5-2' },
231+
{ 'name': 'Proton-tkg.10.6.a34b12f' }
232+
],
233+
False,
234+
id = 'Wine-tkg should not be found'
235+
),
236+
pytest.param(
237+
'GE-Proton9-2',
238+
[
239+
{ 'name': 'Luxtorpeda' },
240+
{ 'name': 'GE-Proton8-16' },
241+
{ 'name': 'GE-Proton9-27' },
242+
{ 'name': 'Proton-GE-5-2' },
243+
{ 'name': 'Proton-tkg.10.6.a34b12f' }
244+
],
245+
False,
246+
id = 'GE-Proton9-2 should not be found'
247+
),
248+
249+
]
250+
)
251+
def test_compat_tool_available(compat_tool_name: str, ctobjs: list[dict[str, str]], expected: bool) -> None:
252+
253+
"""
254+
Given a list of dictionaries containing compatibility tools,
255+
When the name of the compatibility tool is in the list of dictionaries,
256+
Then it should return whether the given compatibility tool name is in the list of dictionaries
257+
"""
258+
259+
result: bool = compat_tool_available(compat_tool_name, ctobjs)
260+
261+
assert result == expected

0 commit comments

Comments
 (0)