Ejemplo n.º 1
0
    def test_pop_from_front(self):
        test_list = DoublyLinkedList()
        test_list.insert_front(5)
        test_list.insert_front(7)
        test_list.insert_front(9)
        front_pop = test_list.pop_front()

        node = test_list.pop_front()
        self.assertEqual(
            7, node._node_value,
            "First item isn't the second item before pop from front")
Ejemplo n.º 2
0
    def test_first_item(self):
        test_list = DoublyLinkedList()
        test_list.insert_front(5)
        test_list.insert_front(9)
        pop = test_list.pop_front()

        self.assertEqual(9, pop, "first item did not insert correctly")
    def test_pop_front(self):

        #Arrange
        double_linked = DoublyLinkedList()
        double_linked.insert_front(1)
        double_linked.insert_front(2)
        double_linked.insert_front(3)

        #Act
        double_linked.pop_front()

        #Assert
        self.assertEqual(2, double_linked.first_node.value,
                         "pop_front did not return the correct node value")
        self.assertEqual(None, double_linked.first_node.prev_node,
                         "pop_front did not return the correct node value")