def test_flatten_0(): lst = [1, 2, [3, 4], [5, [6, 7]]] fiter = FIt(lst) assert_equal_it(fiter.flatten(0), lst)
def test_flatten_nostr(): fiter = FIt([1, [2, "potato"]]) assert_equal_it(fiter.flatten(split_strings=True), [1, 2] + list("potato"))
def test_flatten_levels(): fiter = FIt([1, 2, [3, 4], [5, [6, 7]]]) assert_equal_it(fiter.flatten(levels=1), [1, 2, 3, 4, 5, [6, 7]])
def test_flatten_str(): fiter = FIt([1, [2, "potato"]]) assert_equal_it(fiter.flatten(), [1, 2, "potato"])
def test_flatten(): fiter = FIt([1, 2, [3, 4], [5, [6, 7]]]) assert_equal_it(fiter.flatten(), [1, 2, 3, 4, 5, 6, 7])