From a2e211715a8cde133b0c6bc5bea729843f6f4a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sat, 22 Jun 2024 21:09:33 +0200 Subject: [PATCH] Small adition to test utils --- server/src/tests/utils/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/tests/utils/__init__.py b/server/src/tests/utils/__init__.py index 6a3c4f3de..6bfc45291 100644 --- a/server/src/tests/utils/__init__.py +++ b/server/src/tests/utils/__init__.py @@ -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