Issues (74)

tests/util/test_functional.py (2 issues)

1
import pytest
2
3
from lagom.util.functional import arity, FunctionCollection
4
5
6
def _func_a():
7
    pass
8
9
10
def _func_b():
11
    pass
12
13
14
@pytest.mark.parametrize(
15
    "test_func,expected_arity",
16
    [(lambda: 0, 0), (lambda x: x, 1), (lambda x, y: x + y, 2)],
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable x does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable y does not seem to be defined.
Loading history...
17
)
18
def test_we_can_get_arity_from_functions(test_func, expected_arity: int):
19
    assert arity(test_func) == expected_arity
20
21
22
def test_function_collections_are_the_same_if_they_have_the_same_functions():
23
    assert FunctionCollection(_func_a, _func_b) == FunctionCollection(_func_a, _func_b)
24
25
26
def test_function_collections_have_equality_to_a_list_of_those_functions():
27
    assert FunctionCollection(_func_a, _func_b) == [_func_a, _func_b]
28
29
30
def test_function_collections_are_iterable():
31
    collected_funcs = [func for func in FunctionCollection(_func_a, _func_b)]
32
    assert collected_funcs == [_func_a, _func_b]
33