Ejemplo n.º 1
0
def test_LinkedList_insert_before_multiple_arg_long_head():
    ll = LinkedList()
    ll.insert("oranges", "kiwi", "bananas", "coconut")
    ll.insert_before("kiwi", "1", "2", "3")
    actual = str(ll)
    expected = "{coconut} -> {bananas} -> {3} -> {2} -> {1} -> {kiwi} -> {oranges} ->  NULL"
    assert actual == expected
Ejemplo n.º 2
0
def test_LinkedList_insert_before_present_value():
    ll = LinkedList()
    ll.insert("oranges", "bananas", "coconut")
    ll.insert_before("oranges", "kiwi")
    actual = str(ll)
    expected = "{coconut} -> {bananas} -> {kiwi} -> {oranges} ->  NULL"
    assert actual == expected
Ejemplo n.º 3
0
def test_LinkedList_insert_before_multiple_arg_just_head():
    ll = LinkedList()
    ll.insert("oranges")
    ll.insert_before("oranges", "1", "2", "3")
    actual = str(ll)
    expected = "{3} -> {2} -> {1} -> {oranges} ->  NULL"
    assert actual == expected
Ejemplo n.º 4
0
def test_LinkedList_insert_before_empty_link():
    ll = LinkedList()
    actual = ll.insert_before("apples", "oranges")
    expected = "Exception"
    assert actual == expected