def test_flatten_callable(): def x(): return [1, 2, 3] y = [4, 5, x] assert list(flatten(y)) == [4, 5, 1, 2, 3]
def test_flatten_callable(): x = lambda: [1, 2, 3] y = [4, 5, x] assert list(flatten(y)) == [4, 5, 1, 2, 3]
def test_flatten(): l = [[1, 2, 3], [4], [[[5]]], 'ololo'] assert list(flatten(l)) == [1, 2, 3, 4, 5, 'ololo']
def test_flatten_function_returning_noniterable(): def y(): return 100 assert list(flatten(y)) == [100]
def test_flatten_noniterable(): y = 100 assert list(flatten(y)) == [y]