def test_linked_list_append(): ll = LinkedList() ll.head = Node(1) ll.head.next = Node(2) ll.append(3) assert ll.head.next.next.value == 3 assert ll.head.next.next.next == None
def test_linked_list_append(): """Test a value can be appended to a linked list.""" linked_list = LinkedList() value = 1 linked_list.insert(value) value = 2 linked_list.append(value) assert linked_list.head.next.value == value assert linked_list.head.next.next == None value = 3 linked_list.append(value) assert linked_list.head.next.next.value == value assert linked_list.head.next.next.next == None