def test_linked_list_insert_before():
    ll = LinkedList()
    ll.head = Node(1)
    ll.head.next = Node(2)
    ll.insert_before(2, 3)
    assert ll.head.next.value == 3
    assert ll.head.next.next.value == 2
def test_linked_list_insert_before():
    """Test a new value can be inserted before a value already in the linked list."""

    linked_list = LinkedList()
    value = 1
    linked_list.insert(value)

    new_value = 2
    linked_list.insert_before(value, new_value)
    assert linked_list.head.value == new_value
    assert linked_list.head.next.value == value

    newer_value = 3
    linked_list.insert_before(value, newer_value)
    assert linked_list.head.next.value == newer_value
    assert linked_list.head.next.next.value == value