def test_len_three() -> None: """Test LinkedList.__len__ on a linked list of length 3.""" lst = LinkedList() node1 = _Node(10) node2 = _Node(20) node3 = _Node(30) node1.next = node2 node2.next = node3 lst._first = node1 assert len(lst) == 3
def test_contains_doctest() -> None: """Test LinkedList.__contains__ on the given doctest.""" lst = LinkedList() node1 = _Node(1) node2 = _Node(2) node3 = _Node(3) node1.next = node2 node2.next = node3 lst._first = node1 assert 2 in lst assert not (4 in lst)
def test_append_one() -> None: """Test LinkedList.append on a list of length 1.""" lst = LinkedList() lst._first = _Node(1) lst.append(2) assert lst._first.next.item == 2