예제 #1
0
def test_dll_append_four_right():
    dll = DoubleLinkedList()
    dll.append(1)
    dll.append(2)
    dll.append(3)
    dll.append(4)
    assert dll.right == 4
예제 #2
0
def test_appendleft_many():
    dll = DoubleLinkedList()
    dll.appendleft(1)
    dll.appendleft(2)
    dll.appendleft(3)
    dll.appendleft(4)
    nose.tools.assert_equal(dll.pop(), 1)
예제 #3
0
from linkedlist import DoubleLinkedList

ld = DoubleLinkedList()
print("esta vacia?: ", ld.is_empty())
ld.append(10)
ld.append(20)
ld.append(30)
print(f"la lista tiene: {ld.get_size()}")
ld.transversal()
ld.reverse_transversal()
ld.remove_from_head(20)
예제 #4
0
    def add(self, value):
        def greater_value_node(index, node):
            return node.value > value

        return DoubleLinkedList.add(self, value, where=greater_value_node)
예제 #5
0
def test_appendleft_full():
    dll = DoubleLinkedList(range(3))
    dll.appendleft(5)
    nose.tools.assert_equal(dll.pop(), 2)
예제 #6
0
def test_append_twice_pop_twice():
    dll = DoubleLinkedList()
    dll.append(1)
    dll.append(2)
    dll.pop()
    assert dll.pop() == 1
예제 #7
0
def test_popleft():
    dll = DoubleLinkedList()
    dll.append(1)
    assert dll.popleft() == 1
예제 #8
0
def test_dll_appendleft_twice():
    dll = DoubleLinkedList()
    dll.appendleft(1)
    dll.appendleft(2)
    assert dll.left == 2
예제 #9
0
def test_dll_appendleft_singleton():
    dll = DoubleLinkedList()
    dll.appendleft(1)
    assert dll.left == dll.right == 1
예제 #10
0
def test_dll_append_twice():
    dll = DoubleLinkedList()
    dll.append(1)
    dll.append(2)
    assert dll.right == 2
예제 #11
0
def test_dll_append():
    dll = DoubleLinkedList()
    dll.append(1)
    assert dll.right == 1