def test_insert_on_position_0(): d = DoubleLinkedList([1]) d.insert(0, 0) print("\n", d, "\n") assert (len(d)) == 2 assert d[0] == 0 assert list(d) == [0, 1]
def test_insert_on_position_minus_1(): d = DoubleLinkedList([1, 2, 4]) d.insert(-1, 3) assert (len(d)) == 4 assert d[2] == 3 assert list(d) == [1, 2, 3, 4]
def test_insert_on_position_1(): d = DoubleLinkedList([1, 3, 4]) d.insert(1, 2) assert (len(d)) == 4 assert d[1] == 2 assert list(d) == [1, 2, 3, 4]
def test_insert_on_position_0_larger(): d = DoubleLinkedList([1, 2]) d.insert(0, 0) assert (len(d)) == 3 assert d[0] == 0 assert list(d) == [0, 1, 2]
def test_insert_on_empty(): d = DoubleLinkedList() d.insert(0, 1) assert (len(d)) == 1 assert d[0] == 1