Пример #1
0
def test_flatten3():
    assert [1, 2, 2, 3, 4, 1, 2] == flatten([[1, 2, [2, 3, 4]], 1, 2])
Пример #2
0
def test_flatten():
    assert flatten([1, [2]]) == [1, 2]
    assert flatten([[2, 3], 1, [4]]) == [2, 3, 1, 4]
    assert flatten([[2], [3, [4, [5]]]]) == [2, 3, 4, 5]
Пример #3
0
def test_flatten():
    assert ['a', 1, 2] == flatten(['a', 1, 2])
Пример #4
0
def test_flatten2():
    assert [1, 2, 1, 2] == flatten([[1, 2], 1, 2])
Пример #5
0
def test_flatten2():
    input = [["Hallo"]]
    assert flatten(input) == ["Hallo"]
Пример #6
0
def test_flatten3():
    assert flatten([["Hallo"], ["Welt"]]) == ["Hallo", "Welt"]
Пример #7
0
def test_flatten1():
    input = []
    assert flatten(input) == []
Пример #8
0
def test_flatten_already_flat():
    assert flatten([1,2,3,4,5,6]) == [1,2,3,4,5,6]
Пример #9
0
def test_flatten():
    assert flatten([[1, 'a'], [4,[567,['frt', 'g']]], 7]) == [1, 'a', 4, 567, 'frt', 'g', 7]
Пример #10
0
def test_flatten_recursiv():
    assert flatten([1, 2, 3, [1, 2, 3],
                    [4, 5, [6, 7,
                            [8, 9]]]]) == [1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Пример #11
0
def test_flatten():
    assert flatten([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]