Exemplo n.º 1
0
def test_flatten_callable():
    def x():
        return [1, 2, 3]

    y = [4, 5, x]

    assert list(flatten(y)) == [4, 5, 1, 2, 3]
Exemplo n.º 2
0
def test_flatten_callable():
    x = lambda: [1, 2, 3]
    y = [4, 5, x]

    assert list(flatten(y)) == [4, 5, 1, 2, 3]
Exemplo n.º 3
0
def test_flatten():
    l = [[1, 2, 3], [4], [[[5]]], 'ololo']

    assert list(flatten(l)) == [1, 2, 3, 4, 5, 'ololo']
Exemplo n.º 4
0
def test_flatten_callable():
    x = lambda: [1, 2, 3]
    y = [4, 5, x]

    assert list(flatten(y)) == [4, 5, 1, 2, 3]
Exemplo n.º 5
0
def test_flatten():
    l = [[1, 2, 3], [4], [[[5]]], 'ololo']

    assert list(flatten(l)) == [1, 2, 3, 4, 5, 'ololo']
Exemplo n.º 6
0
def test_flatten_function_returning_noniterable():
    def y():
        return 100

    assert list(flatten(y)) == [100]
Exemplo n.º 7
0
def test_flatten_noniterable():
    y = 100
    assert list(flatten(y)) == [y]