def test_construct(): """ GIVEN WHEN linked list is constructed THEN head is None. """ list_ = linked_list.LinkedList() assert list_.head is None
def test_add_empty(empty_list): """ GIVEN empty linked list value to add WHEN add is called with the value THEN head is replaced with a Node with value set to input value and next_ set to None. """ list_ = linked_list.LinkedList() value = "value 1" list_.add_first(value) assert list_.head.value == value assert list_.head.next_ is None
def __init__(self): """Construct.""" self._list = linked_list.LinkedList()
def empty_list(): """Linked list with empty value.""" list_ = linked_list.LinkedList() return list_