def get_incremented_run_list(self): """ Updates list of runs by adding a run equal to 1 after to the highest run. """ run_list = load_utils.flatten_run_list(copy.copy(self._model.current_runs)) if run_list is None or len(run_list) == 0: return [] if len(run_list) == 1: run_list = [run_list[0], run_utils.increment_run(run_list[0])] else: run_list = run_utils.increment_run_list(run_list) return run_list
def get_incremented_run_list(self): """ Updates list of runs by adding a run equal to 1 after to the highest run. """ run_list = load_utils.flatten_run_list(copy.copy(self.runs)) if run_list is None or len(run_list) == 0: return [] if len(run_list) == 1: run_list = [run_list[0], run_utils.increment_run(run_list[0])] else: run_list = run_utils.increment_run_list(run_list) return run_list
def test_can_correctly_increment_run_list_by_five(self): run_list = [1, 2, 3, 4, 5] increment = 5 incremented_run_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] self.assertEqual(utils.increment_run_list(run_list, increment), incremented_run_list)
def test_can_correctly_increment_run_list_by_one(self): run_list = [1, 2, 3, 4, 5] increment = 1 incremented_run_list = [1, 2, 3, 4, 5, 6] self.assertEqual(utils.increment_run_list(run_list, increment), incremented_run_list)
def test_cannot_increment_or_decrement_by_zero_or_negative_numbers(self): run_list = [1, 2, 3, 4, 5] self.assertEqual(utils.increment_run_list(run_list, 0), run_list) self.assertEqual(utils.increment_run_list(run_list, -1), run_list) self.assertEqual(utils.decrement_run_list(run_list, 0), run_list) self.assertEqual(utils.decrement_run_list(run_list, -1), run_list)