コード例 #1
0
ファイル: load_run_presenter.py プロジェクト: dpaj/mantid
 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
コード例 #2
0
ファイル: presenter.py プロジェクト: samueljackson92/mantid
 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
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 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)