Beispiel #1
0
    def test_insert_2(self):
        linked_list = LinkedList()
        linked_list.add_in_tail(self.n1)
        linked_list.add_in_tail(self.n3)

        linked_list.insert(self.n3, self.n6)
        self.assertEqual(linked_list.head, self.n1)
        self.assertEqual(linked_list.tail, self.n6)
        self.assertEqual(self.n3.next, self.n6)
        self.assertEqual(self.n6.next, None)
        self.assertEqual(self.n6.prev, self.n3)
Beispiel #2
0
    def test_insert_1(self):
        linked_list = LinkedList()

        linked_list.insert(None, self.n6)
        self.assertEqual(linked_list.head, self.n6)
        self.assertEqual(linked_list.tail, self.n6)