Exemplo n.º 1
0
def test_interpose():
    assert "a" == first(rest(interpose("a", range(1000000000))))
    assert "tXaXrXzXaXn" == "".join(interpose("X", "tarzan"))
    assert list(interpose(0, itertools.repeat(1, 4))) == [1, 0, 1, 0, 1, 0, 1]
    assert list(interpose('.', ['a', 'b', 'c'])) == ['a', '.', 'b', '.', 'c']
Exemplo n.º 2
0
def test_interpose():
    assert "a" == first(rest(interpose("a", range(1000000000))))
    assert "tXaXrXzXaXn" == "".join(interpose("X", "tarzan"))
    assert list(interpose(0, itertools.repeat(1, 4))) == [1, 0, 1, 0, 1, 0, 1]
    assert list(interpose('.', ['a', 'b', 'c'])) == ['a', '.', 'b', '.', 'c']
Exemplo n.º 3
0
def test_rest():
    assert list(rest('ABCDE')) == list('BCDE')
    assert list(rest((3, 2, 1))) == list((2, 1))
Exemplo n.º 4
0
def is_monotonic(num: str):
    return all(n2 >= n1 for n1, n2 in zip(num, rest(num)))
Exemplo n.º 5
0
def test_rest():
    assert list(rest('ABCDE')) == list('BCDE')
    assert list(rest((3, 2, 1))) == list((2, 1))
Exemplo n.º 6
0
def has_double(num: str):
    return any(n1 == n2 for n1, n2 in zip(num, rest(num)))
Exemplo n.º 7
0
def test_interpose():
    assert "a" == first(rest(interpose("a", range(1000000000))))
    assert "tXaXrXzXaXn" == "".join(interpose("X", "tarzan"))
    assert list(interpose(0, itertools.repeat(1, 4))) == [1, 0, 1, 0, 1, 0, 1]
    assert list(interpose(".", ["a", "b", "c"])) == ["a", ".", "b", ".", "c"]
Exemplo n.º 8
0
def test_rest():
    assert list(rest("ABCDE")) == list("BCDE")
    assert list(rest((3, 2, 1))) == list((2, 1))
Exemplo n.º 9
0
def test_interpose():
    assert "a" == first(rest(interpose("a", range(1000000000))))
    assert "tXaXrXzXaXn" == "".join(interpose("X", "tarzan"))
    assert list(interpose(0, itertools.repeat(1, 4))) == [1, 0, 1, 0, 1, 0, 1]
    assert list(interpose(".", ["a", "b", "c"])) == ["a", ".", "b", ".", "c"]
Exemplo n.º 10
0
def test_rest():
    assert list(rest("ABCDE")) == list("BCDE")
    assert list(rest((3, 2, 1))) == list((2, 1))