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

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

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

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

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

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