コード例 #1
0
 def test_del_mass_void_all(self):
     s_list = LinkedList()
     s_list.delete(1, True)
     ht = s_list.get_head_tail()
     data = ht + s_list.list_all_nodes()
     res = [None, None]
     self.assertEqual(data, res)
コード例 #2
0
 def test_del_mass_first_1_all(self):
     n1 = Node(1)
     s_list = LinkedList()
     s_list.add_in_tail(n1)
     s_list.delete(1, True)
     ht = s_list.get_head_tail()
     data = ht + s_list.list_all_nodes()
     res = [None, None]
     self.assertEqual(data, res)
コード例 #3
0
 def test_del_one_last_2(self):
     n1 = Node(1)
     n2 = Node(2)
     s_list = LinkedList()
     s_list.add_in_tail(n1)
     s_list.add_in_tail(n2)
     s_list.delete(2)
     ht = s_list.get_head_tail()
     data = ht + s_list.list_all_nodes()
     res = [n1, n1, 1]
     self.assertEqual(data, res)
コード例 #4
0
 def test_del_one_first_3(self):
     n1 = Node(1)
     n2 = Node(2)
     n3 = Node(3)
     s_list = LinkedList()
     s_list.add_in_tail(n1)
     s_list.add_in_tail(n2)
     s_list.add_in_tail(n3)
     s_list.delete(1)
     ht = s_list.get_head_tail()
     data = ht + s_list.list_all_nodes()
     res = [n2, n3, 2, 3]
     self.assertEqual(data, res)
コード例 #5
0
 def test_del_mass_no_element(self):
     n1 = Node(1)
     n2 = Node(1)
     n3 = Node(3)
     s_list = LinkedList()
     s_list.add_in_tail(n1)
     s_list.add_in_tail(n2)
     s_list.add_in_tail(n3)
     s_list.delete(4, True)
     ht = s_list.get_head_tail()
     data = ht + s_list.list_all_nodes()
     res = [n1, n3, 1, 1, 3]
     self.assertEqual(data, res)