Example #1
0
def test_s_get_3():
    l = LinkedList()
    l.push(10)
    l.push(11)
    l.push(12)
    l.pop()
    try:
        l.get(2)
        raise AssertionError("IndexError not raised as expected!")
    except IndexError:
        pass
Example #2
0
def test_s_len_3():
    l = LinkedList()
    l.push(5)
    l.push(2)
    l.pop()

    assert l.len() == 1
Example #3
0
def test_s_remove_2():
    l = LinkedList()
    l.push(5)
    l.push(6)

    l.remove(19)
    m = '[5, 6]'
    assert str(l).strip() == m
Example #4
0
def test_s_get_2():
    l = LinkedList()
    l.push(10)
    l.push(11)
    l.push(12)
    assert l.get(1) == 11
Example #5
0
def test_s_len_1():
    l = LinkedList()
    l.push(5)
    l.push(6)

    assert l.len() == 2
Example #6
0
def test_s_len_2():
    l = LinkedList()
    assert l.len() == 0