1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Small adition to test utils

This commit is contained in:
Adolfo Gómez García 2024-06-22 21:09:33 +02:00
parent 263e9f4b5d
commit a2e211715a
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -180,6 +180,13 @@ def filter_list_by_attr(lst: list[T], attribute: str, value: typing.Any, **kwarg
"""
return [item for item in lst if getattr(item, attribute) == value or value is None]
def filter_list_by_attr_list(lst: list[T], attribute: str, values: list[typing.Any], **kwargs: typing.Any) -> list[T]:
"""
Returns a list of items from a list of items
kwargs are not used, just to let use it as partial on fixtures
"""
return [item for item in lst if getattr(item, attribute) in values]
def check_userinterface_values(obj: ui.UserInterface, values: ui.gui.ValuesDictType) -> None:
"""
Checks that a user interface object has the values specified