def test_get_not_in(): assert_equal(List([1]).get(1), None)
def test_concatenate_multiple(x): y = List([5, 6, 7, 8]) z = List([9, 10]) for i, x in enumerate(x.concatenate(y, z)): assert_equal(i + 1, x)
def test_nth_1(): x = List(range(100)) for i, x in enumerate(x.nth(1)): assert_equal(i, x)
def test_get_in_reset_dflt(): x = List([1]) x.DFLT = "dflt" assert_equal(x.get_in(1), "dflt")
def test_get_in_not_in(): assert_equal(List([Dict({1: 1})]).get_in(1, 1), None)
def test_flatten_deeply(): assert_equal(List([[1], [2], 3, [4, [5]]]).flatten(), list(range(1, 6)))
def test_update_in(): assert_equal( List([Dict({1: 1})]).update_in(0, 1, to=2), List([Dict({1: 2})]))
def test_take(): assert_equal(List(List(range(10)).take(5)), List(range(5)))
def test_take_iterate(): for i, e in enumerate(List(range(10)).take(5)): assert_equal(i, e)
def test_remove_empty_custom_fun(): assert_equal(List([1, 2, 3, 4]).remove_empty(fun=lambda x: x != 4), List([1, 2, 3]))
def test_clear(): assert_equal(List([1,2]).clear(), List([]))
def test_remove_empty(): assert_equal(List([1, 2, 3, None]).remove_empty(), List([1, 2, 3]))
def test_reset(): reset = List([1]) assert_equal(List([1, 2, 3, 4]).reset(reset), reset)
def test_get_dflt(): assert_equal(List([1]).get(1, "dflt"), "dflt")
def test_rindex(): assert_equal(List(range(10)).rindex(8), 1)
def test_drop(): assert_equal(List(List(range(10)).drop(5)), List(range(5,10)))
def test_flatten(): assert_equal(List([[0], [1, 2], []]).flatten(), [0, 1, 2])
def test_drop_iterate(): dropped = 5 for i, e in enumerate(List(range(10)).drop(dropped)): assert_equal(i + dropped, e)
def test_extend(): assert_equal(List([1,2]).extend([3]), List([1, 2, 3]))
def test_take_while(): assert_equal(List(List(range(10)).take_while(lambda x: x < 5)), List(range(5)))
def test_get_in_dflt(): assert_equal(List([1]).get_in(1, dflt="dflt"), "dflt")
def test_take_while_iterate(): for i, e in enumerate(List(range(10)).take_while(lambda x: x < 5)): assert_equal(i, e)
def test_get_in(): assert_equal(List([Dict({1: 1})]).get_in(0, 1), 1)
def test_drop_while(): assert_equal(List(List(range(10)).drop_while(lambda x: x < 5)), List(range(5,10)))
def test_concatenate(x): y = List([5, 6, 7, 8]) for i, x in enumerate(x.concatenate(y)): assert_equal(i + 1, x)
def test_drop_while_iterate(): dropped = 5 for i, e in enumerate(List(range(10)).drop_while(lambda x: x < dropped)): assert_equal(i + dropped, e)
def test_nth(): x = List(range(100)) for i in x.nth(2): assert_equal(i % 2, 0)
def test_append(): assert_equal(List([1,2]).append(3), List([1, 2, 3]))
def internal(): x = List([1, 2, 3, 4]) f(x)
def test_get(): assert_equal(List([1]).get(0), 1)