def test_before_and_after(self): runs = self.runs for i in reversed( list(frequency_index_gen(runs, 2, ('unknown', ), True, True))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, [ 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', ])
def test_after_subset2(self): runs = self.runs sidx = 3 for i in reversed(list(frequency_index_gen(runs[sidx:], 3, ('unknown', ), False, True, sidx=sidx))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, ['unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown'])
def test_not_before_or_after3(self): runs = self.runs for i in reversed(list(frequency_index_gen(runs, 3, ('unknown', ), False, False))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, ['unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown'])
def _test_template(self, temp, exp, runs=None): if runs is None: runs = [Run() for i in range(3)] for i in reversed(list(frequency_index_gen(runs, temp, ('unknown', ), False, False))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] # print 'exception', exp # print atypes self.assertListEqual(atypes, exp)
def test_before_and_after(self): runs = self.runs for i in reversed(list(frequency_index_gen(runs, 2, ('unknown', ), True, True))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, ['blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'blank', ])
def test_not_before_or_after3(self): runs = self.runs for i in reversed( list(frequency_index_gen(runs, 3, ('unknown', ), False, False))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, [ 'unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown' ])
def _test_template(self, temp, exp, runs=None): if runs is None: runs = [Run() for i in range(3)] for i in reversed( list( frequency_index_gen(runs, temp, ('unknown', ), False, False))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] # print 'exception', exp # print atypes self.assertListEqual(atypes, exp)
def _add_frequency_runs(self, runspecs, freq, freq_before, freq_after, is_run_block, is_repeat_block): aruns = self.automated_runs runblock = self.automated_runs if is_repeat_block: idx = aruns.index(self.selected[-1]) sidx = idx + freq else: if len(self.selected) > 1: runblock = self.selected sidx = aruns.index(runblock[0]) else: sidx = 0 self._frequency_group_counter += 1 fcnt = self._frequency_group_counter runs = [] if is_run_block: incrementable_types = ('unknown', ) else: run = runspecs[0] rtype = run.analysis_type incrementable_types = ('unknown', ) if len(runspecs) == 1: if rtype.startswith('blank'): t = '_'.join(rtype.split('_')[1:]) incrementable_types = (t, ) for idx in reversed( list( frequency_index_gen(runblock, freq, incrementable_types, freq_before, freq_after, sidx=sidx))): for ri in reversed(runspecs): run = ri.clone_traits() run.frequency_group = fcnt runs.append(run) aruns.insert(idx, run) return runs
def test_after_subset2(self): runs = self.runs sidx = 3 for i in reversed( list( frequency_index_gen(runs[sidx:], 3, ('unknown', ), False, True, sidx=sidx))): r = Run() r.analysis_type = 'blank' runs.insert(i, r) atypes = [ri.analysis_type for ri in runs] self.assertListEqual(atypes, [ 'unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'blank', 'unknown', 'unknown', 'unknown', 'blank', 'unknown' ])
def _add_frequency_runs(self, runspecs, freq, freq_before, freq_after, is_run_block, is_repeat_block): aruns = self.automated_runs runblock = self.automated_runs if is_repeat_block: idx = aruns.index(self.selected[-1]) sidx = idx + freq else: if len(self.selected) > 1: runblock = self.selected sidx = aruns.index(runblock[0]) else: sidx = 0 self._frequency_group_counter += 1 fcnt = self._frequency_group_counter runs = [] if is_run_block: incrementable_types = ('unknown',) else: run = runspecs[0] rtype = run.analysis_type incrementable_types = ('unknown',) if rtype.startswith('blank'): incrementable_types = ('unknown', 'air', 'cocktail') elif rtype.startswith('air') or rtype.startswith('cocktail'): incrementable_types = ('unknown',) for idx in reversed(list(frequency_index_gen(runblock, freq, incrementable_types, freq_before, freq_after, sidx=sidx))): for ri in reversed(runspecs): run = ri.clone_traits() run.frequency_group = fcnt runs.append(run) aruns.insert(idx, run) return runs