def test_pop(): u"""Assert .pop() removes and returns the h value from the list.""" doubly_linked = DoublyLinked() for val in VALUES: doubly_linked.append(val) for val in VALUES: assert doubly_linked.pop() == val assert doubly_linked.pop() is None
def test_remove(): u"""Assert .remove() removes the first matching value from the list.""" doubly_linked = DoublyLinked() for val in VALUES: doubly_linked.insert(val) test_vals = VALUES[:] while test_vals: val = random.choice(test_vals) doubly_linked.remove(val) test_vals.remove(val) assert doubly_linked.pop() is None assert doubly_linked.head is None assert doubly_linked.tail is None doubly_linked.insert(1) with pytest.raises(LookupError): doubly_linked.remove("test value")