def test_copy(): list = SingleLinkedList() list.append(1).append(2).append(3) copy = list.copy() assert not copy == list assert copy.size() == 3 assert copy.size() == list.size() assert copy.head() == 1
def test_remove_last(): list = SingleLinkedList() list.removeLast() assert list.isEmpty() list.append(1).removeLast() assert list.isEmpty() list.prepend(3).prepend(2).prepend(1) assert list.size() == 3 list.removeLast() assert list.head() == 1 assert list.size() == 2 list.removeLast().removeLast().removeLast() assert list.size() == 0
def test_append(): list = SingleLinkedList() list.append(1) assert list.head() == 1 list.append(2).append(3) assert list.head() == 1