diff --git a/server/src/tests/utils/__init__.py b/server/src/tests/utils/__init__.py index 071729907..6a3c4f3de 100644 --- a/server/src/tests/utils/__init__.py +++ b/server/src/tests/utils/__init__.py @@ -163,18 +163,20 @@ class MustBeOfType: def __repr__(self) -> str: return self.__str__() -def search_item_by_attr(lst: list[T], attribute: str, value: typing.Any) -> T: +def search_item_by_attr(lst: list[T], attribute: str, value: typing.Any, **kwargs: typing.Any) -> T: """ Returns an item from a list of items + kwargs are not used, just to let use it as partial on fixtures """ for item in lst: if getattr(item, attribute) == value: return item raise ValueError(f'Item with {attribute}=="{value}" not found in list {str(lst)[:100]}') -def filter_list_by_attr(lst: list[T], attribute: str, value: typing.Any) -> list[T]: +def filter_list_by_attr(lst: list[T], attribute: str, value: 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) == value or value is None]