def test_insert_at_0_on_empty_list(self):
     """
     Tests insertion of node on empty list
     """
     l = LinkedList()
     l.insert_at("hi", 0)
     self.assertEqual(l.get_first().data, "hi")
 def test_insert_at_out_of_bounds(self):
     """
     Tests that node is inserted at the end of a list when index is out of bounds
     """
     l = LinkedList()
     l.insert_last("a")
     l.insert_last("b")
     l.insert_at("hi", 30)
     self.assertEqual(l.get_at(0).data, "a")
     self.assertEqual(l.get_at(1).data, "b")
     self.assertEqual(l.get_at(2).data, "hi")
 def test_insert_at_last_index(self):
     """
     Tests for insertion of node at the end of a list
     """
     l = LinkedList()
     l.insert_last("a")
     l.insert_last("b")
     l.insert_at("hi", 2)
     self.assertEqual(l.get_at(0).data, "a")
     self.assertEqual(l.get_at(1).data, "b")
     self.assertEqual(l.get_at(2).data, "hi")
 def test_insert_at_0_non_empty_list(self):
     """
     Tests for insertion of node at index 0 on non-empty list
     """
     l = LinkedList()
     l.insert_last("a")
     l.insert_last("b")
     l.insert_last("c")
     l.insert_at("hi", 0)
     self.assertEqual(l.get_at(0).data, "hi")
     self.assertEqual(l.get_at(1).data, "a")
     self.assertEqual(l.get_at(2).data, "b")
     self.assertEqual(l.get_at(3).data, "c")
 def test_insert_at_middle_index(self):
     """
     Test for insertion of node at index in the middle of a list
     """
     l = LinkedList()
     l.insert_last("a")
     l.insert_last("b")
     l.insert_last("c")
     l.insert_last("d")
     l.insert_at("hi", 2)
     self.assertEqual(l.get_at(0).data, "a")
     self.assertEqual(l.get_at(1).data, "b")
     self.assertEqual(l.get_at(2).data, "hi")
     self.assertEqual(l.get_at(3).data, "c")
     self.assertEqual(l.get_at(4).data, "d")