Beispiel #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]
Beispiel #2
0
def test_flatten_callable():
    x = lambda: [1, 2, 3]
    y = [4, 5, x]

    assert list(flatten(y)) == [4, 5, 1, 2, 3]
Beispiel #3
0
def test_flatten():
    l = [[1, 2, 3], [4], [[[5]]], 'ololo']

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

    assert list(flatten(y)) == [4, 5, 1, 2, 3]
Beispiel #5
0
def test_flatten():
    l = [[1, 2, 3], [4], [[[5]]], 'ololo']

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

    assert list(flatten(y)) == [100]
Beispiel #7
0
def test_flatten_noniterable():
    y = 100
    assert list(flatten(y)) == [y]