Пример #1
0
def test_slides():
    from xoutil.iterators import slides
    assert list(slides(range(1, 11))) == [(1, 2),
                                          (3, 4),
                                          (5, 6),
                                          (7, 8),
                                          (9, 10)]
Пример #2
0
def test_slides_with_cycling_filling():
    from xoutil.iterators import slides
    aux = [(1, 2, 3, 4, 5), (6, 7, 8, 9, 10), (11, 1, 2, 1, 2)]
    assert list(slides(range(1, 12), width=5, fill=(1, 2))) == aux
Пример #3
0
def test_slides_with_repeating_filling():
    from xoutil.iterators import slides
    aux = [(1, 2, 3), (4, 5, 6), (7, 8, 9), (10, None, None)]
    assert list(slides(range(1, 11), width=3, fill=None)) == aux
Пример #4
0
def test_slides_filling():
    from xoutil.iterators import slides
    assert list(slides(range(1, 5), 3)) == [(1, 2, 3), (4, None, None)]