def test_integerListRemoveIndex_whenIndexIsInvalid_shouldRaise(self): il = IntegerList(1, 2, 3, 4, 5, 6, 7) with self.assertRaises(Exception) as context: il.remove_index(len(il.get_data())) self.assertIsNotNone(context.exception)
def test_integerListRemoveIndex_whenIndexIsValid_shouldRemoveElementAndReturnIt(self): il = IntegerList(1, 2, 3, 4, 5, 6, 7) returned = il.remove_index(3) self.assertListEqual([1, 2, 3, 5, 6, 7], il.get_data()) self.assertEqual(4, returned)