コード例 #1
0
def test_construct():
    """
    GIVEN
    WHEN linked list is constructed
    THEN head is None.
    """
    list_ = linked_list.LinkedList()

    assert list_.head is None
コード例 #2
0
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
コード例 #3
0
 def __init__(self):
     """Construct."""
     self._list = linked_list.LinkedList()
コード例 #4
0
def empty_list():
    """Linked list with empty value."""
    list_ = linked_list.LinkedList()
    return list_