コード例 #1
0
ファイル: test_itertoolz.py プロジェクト: aitatanit/cytoolz
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']
コード例 #2
0
ファイル: test_itertoolz.py プロジェクト: adamchainz/cytoolz
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']
コード例 #3
0
ファイル: test_itertoolz.py プロジェクト: aitatanit/cytoolz
def test_rest():
    assert list(rest('ABCDE')) == list('BCDE')
    assert list(rest((3, 2, 1))) == list((2, 1))
コード例 #4
0
def is_monotonic(num: str):
    return all(n2 >= n1 for n1, n2 in zip(num, rest(num)))
コード例 #5
0
ファイル: test_itertoolz.py プロジェクト: adamchainz/cytoolz
def test_rest():
    assert list(rest('ABCDE')) == list('BCDE')
    assert list(rest((3, 2, 1))) == list((2, 1))
コード例 #6
0
def has_double(num: str):
    return any(n1 == n2 for n1, n2 in zip(num, rest(num)))
コード例 #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"]
コード例 #8
0
def test_rest():
    assert list(rest("ABCDE")) == list("BCDE")
    assert list(rest((3, 2, 1))) == list((2, 1))
コード例 #9
0
ファイル: test_itertoolz.py プロジェクト: namitkewat/cytoolz
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"]
コード例 #10
0
ファイル: test_itertoolz.py プロジェクト: namitkewat/cytoolz
def test_rest():
    assert list(rest("ABCDE")) == list("BCDE")
    assert list(rest((3, 2, 1))) == list((2, 1))