def test_number_averaging_normal(self):
     self.assertEquals(number_average([0.0, 1.0, 2.0, 3, 4, 5], simple_func), 2.5)
     self.assertEquals(number_average([0.0, 1.0, 2.0, 3, 4, 5], simple_func), 2.5)
     self.assertEquals(number_average([0, 1, 2, 3, 4, 11], simple_func), 3.5)
     list = LinkedList()
     list.add_last(0)
     self.assertEquals(number_average(list, simple_func), 0)
 def test_linked_list(self):
     for test_ob in self.test_cases:
         list = LinkedList()
         for val in test_ob['values']:
             list.add_last(val)
         r_list = LinkedList()
         for val in list:
             r_list.add_first(val)
         i = 0
         for val in list:
             self.assertEqual(val, test_ob['values'][i])
             i += 1
         i = len(test_ob['values']) - 1
         for val in r_list:
             self.assertEqual(val, test_ob['values'][i])
             i -= 1
 def test_linked_list(self):
     for test_ob in self.test_cases:
         list = LinkedList()
         for val in test_ob['values']:
             list.add_last(val)
         r_list = LinkedList()
         for val in list:
             r_list.add_first(val)
         i = 0
         for val in list:
             self.assertEqual(val, test_ob['values'][i])
             i += 1
         i = len(test_ob['values']) - 1
         for val in r_list:
             self.assertEqual(val, test_ob['values'][i])
             i -= 1
 def get_single_node_list(self):
     list = LinkedList()
     node = LinkedListNode(0)
     list.add_last_node(node)
     return (list, node)
 def get_single_node_list(self):
     list = LinkedList()
     node = LinkedListNode(0)
     list.add_last_node(node)
     return (list, node)