コード例 #1
0
 def test_delete_index_5_many_element_list(self):
     linked = LinkedList(['one', 'two', 3, 4])
     with self.assertRaises(OutOfRangeError):
         linked.delete_at_index(5)
コード例 #2
0
 def test_delete_index_3_many_element_list(self):
     linked = LinkedList(['one', 'two', 3, 4])
     linked.delete_at_index(3)
     self.assertEqual("| one | -> | two | -> | 3 | -> None", str(linked))
コード例 #3
0
 def test_delete_index_0_one_element_list(self):
     linked = LinkedList(['one'])
     linked.delete_at_index(0)
     self.assertEqual(None, linked.first_node)
コード例 #4
0
 def test_delete_index_1_one_element_list(self):
     linked = LinkedList(['one'])
     with self.assertRaises(OutOfRangeError):
         linked.delete_at_index(1)
コード例 #5
0
 def test_delete_index_1_empty_list(self):
     linked = LinkedList([])
     with self.assertRaises(OutOfRangeError):
         linked.delete_at_index(1)