def test_insert_before_reference_does_not_exist():
    ll = LinkedList()
    with pytest.raises(Exception) as context:
        ll.insert(1)
        ll.insert_before(3, 5)
    assert str(context.value) == 'No node containing: 5'
def test_insert_before_exists():
    ll = LinkedList()
    ll.insert(3)
    ll.insert(1)
    ll.insert_before(2, 3)
    assert str(ll) == '{ 1 } -> { 2 } -> { 3 } -> NULL'
def test_insert_before_empty():
    ll = LinkedList()
    with pytest.raises(Exception) as context:
        ll.insert_before(3, 5)
    assert str(context.value) == "Cannot `insert_before` on empty LinkedList"