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

tests.unit.util.iterables.test_partition   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_partition() 0 18 3
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 partition
9
10
11
@pytest.mark.parametrize(
12
    'iterable, predicate, expected',
13
    [
14
        (
15
            [],
16
            lambda x: x > 3,
0 ignored issues
show
Comprehensibility Best Practice introduced by Jochen Kupperschmidt
The variable x does not seem to be defined.
Loading history...
17
            ([], []),
18
        ),
19
        (
20
            [0, 1, 2, 3, 4, 5, 6, 7],
21
            lambda x: x % 3 == 0,
0 ignored issues
show
Comprehensibility Best Practice introduced by Jochen Kupperschmidt
The variable x does not seem to be defined.
Loading history...
22
            ([0, 3, 6], [1, 2, 4, 5, 7]),
23
        ),
24
    ],
25
)
26
def test_partition(iterable, predicate, expected):
27
    actual = partition(iterable, predicate)
28
    assert actual == expected
29