Esempio n. 1
0
def test_inits_heads(elements: List[int]) -> None:
    """inits(elements)[:1] == [[], [elements[0]]."""
    assert sut.inits(elements)[0] == []
    assert sut.inits(elements)[1] == [elements[0]]
Esempio n. 2
0
def test_inits_monotonic_length(elements: List[int]) -> None:
    """[len(x) for xs in inits(elements)] == range(len(elements) + 1)."""
    lengths = [len(xs) for xs in sut.inits(elements)]

    assert lengths == list(range(len(elements) + 1))
Esempio n. 3
0
def test_inits_length(elements: List[int]) -> None:
    """len(inits(elements)) == len(elements) + 1."""
    assert len(sut.inits(elements)) == len(elements) + 1