Completed
Push — main ( 84e7fd...b765c6 )
by Jochen
04:23
created

tests/unit/util/iterables/test_index_of.py (4 issues)

1
"""
2
:Copyright: 2006-2020 Jochen Kupperschmidt
3
:License: Modified BSD, see LICENSE for details.
4
"""
5
6
import pytest
7
8
from byceps.util.iterables import index_of
9
10
11
@pytest.mark.parametrize(
12
    'iterable, predicate, expected',
13
    [
14
        (
15
            [],
16
            lambda x: x > 3,
1 ignored issue
show
Comprehensibility Best Practice introduced by
The variable x does not seem to be defined.
Loading history...
17
            None,
18
        ),
19
        (
20
            [2, 3, 4, 5],
21
            lambda x: x > 1,
1 ignored issue
show
Comprehensibility Best Practice introduced by
The variable x does not seem to be defined.
Loading history...
22
            0,
23
        ),
24
        (
25
            [2, 3, 4, 5],
26
            lambda x: x > 3,
1 ignored issue
show
Comprehensibility Best Practice introduced by
The variable x does not seem to be defined.
Loading history...
27
            2,
28
        ),
29
        (
30
            [2, 3, 4, 5],
31
            lambda x: x > 6,
1 ignored issue
show
Comprehensibility Best Practice introduced by
The variable x does not seem to be defined.
Loading history...
32
            None,
33
        ),
34
    ],
35
)
36
def test_index_of(iterable, predicate, expected):
37
    actual = index_of(iterable, predicate)
38
    assert actual == expected
39