Exemple #1
0
def test_push_back_in_empty_list():
    list = LinkedList()
    list.push_back(10)

    assert list.size == 1
    assert list.is_empty == False
    assert len(list) == 1
Exemple #2
0
def value_at_fixture():
    list = LinkedList()

    for i in range(10):
        list.push_back(i)

    return list
Exemple #3
0
def search_fixture():
    list = LinkedList()

    for i in range(5):
        list.push_front(i)

    return list
Exemple #4
0
def test_front():
    list = LinkedList()
    list.push_front(1)

    assert list.front == 1
    assert list.size == 1
    assert list.is_empty == False
    assert len(list) == 1
Exemple #5
0
def test_push_back_using_back():
    list = LinkedList()
    list.back = 1

    assert list.front == 1
    assert list.back == 1
    assert list.size == 1
    assert list.is_empty == False
    assert len(list) == 1
Exemple #6
0
def test_back_and_push():
    list = LinkedList()
    list.push_back(11)

    assert list.back == 11
    assert list.front == 11

    assert list.size == 1
    assert list.is_empty == False
    assert len(list) == 1
Exemple #7
0
def test_change_front_element():
    list = LinkedList()

    for i in range(5):
        list.push_front(i)

    assert list.front == 4
    assert list.back == 0

    list.front = 100

    assert list.front == 100
    assert list.back == 0
Exemple #8
0
def test_make_list():
    list = LinkedList()

    assert list.size == 0
    assert list.is_empty == True
    assert len(list) == 0
Exemple #9
0
def test_back_from_empty():
    list = LinkedList()

    with pytest.raises(CollectionIsEmptyExeption) as exception_info:
        value = list.back
    assert str(exception_info.value) == list_is_empty()
Exemple #10
0
def test_remove_from_empty_list():
    list = LinkedList()
    assert list.remove_value(100) is False
Exemple #11
0
def test_pop_front_negative(value_at_fixture):
    list = LinkedList()

    with pytest.raises(CollectionIsEmptyExeption) as exception_info:
        value = list.pop_back()
    assert str(exception_info.value) == list_is_empty()
Exemple #12
0
def test_value_at_empty_list():
    list = LinkedList()

    with pytest.raises(CollectionIsEmptyExeption) as exception_info:
        value = list.value_at(list.size)
    assert str(exception_info.value) == list_is_empty()
Exemple #13
0
def test_search_in_empty_list_using_in():
    list = LinkedList()

    assert (10 in list) == False
Exemple #14
0
def test_search_in_empty_list():
    list = LinkedList()

    assert list.contains(10) == False