Пример #1
0
 def test_get_node_index_exists_1(self):
     linked = LinkedList(['one', 'two'])
     self.assertEqual('two', linked.get_node_at_index(1).data)
Пример #2
0
 def test_get_node_index_doesnot_exist(self):
     linked = LinkedList(['one', 'two', 3, 4, 5])
     with self.assertRaises(OutOfRangeError):
         linked.get_node_at_index(6)
Пример #3
0
 def test_get_node_index_empty_list(self):
     linked = LinkedList([])
     with self.assertRaises(OutOfRangeError):
         linked.get_node_at_index(2)