예제 #1
0
    def testAnalyzeOutputFrom(self):
        '''Test extracting of from=value option from input'''
        script = SoS_Script('''
[A_1]
input:  output_from('B')

[A_2]
input: something_unknown, sos_groups(output_from(['C1', 'C2']), by=2), group_by=1
''')
        wf = script.workflow('A')
        for section in wf.sections:
            res = analyze_section(section)
            if section.names[0][1] == 1:
                self.assertEqual(res['step_depends'], sos_targets(sos_step('B')))
            if section.names[0][1] == 2:
                self.assertTrue(res['step_depends'] == sos_targets(sos_step('C1'), sos_step('C2')))
예제 #2
0
    def testAnalyzeFromOption(self):
        '''Test extracting of from=value option from input'''
        script = SoS_Script('''
[A_1]
input:  from_steps='B'

[A_2]
input: something_unknown, from_steps=['B', 'C2'], group_by=1
''')
        wf = script.workflow('A')
        for section in wf.sections:
            res = analyze_section(section)
            if section.names[0][1] == '1':
                self.assertEqual(res['step_depends'],
                                 sos_targets(sos_step('B')))
            if section.names[0][1] == '2':
                self.assertTrue(res['step_depends'] == sos_targets(
                    sos_step('B'), sos_step('C2')))
예제 #3
0
파일: test_utils.py 프로젝트: pgcudahy/sos
def test_analyze_output_from():
    '''Test extracting of from=value option from input'''
    script = SoS_Script('''
[A_1]
input:  output_from('B')

[A_2]
input: something_unknown, sos_groups(output_from(['C1', 'C2']), by=2), group_by=1
''')
    wf = script.workflow('A')
    Base_Executor(wf)
    for section in wf.sections:
        res = analyze_section(section, analysis_type='forward')
        if section.names[0][1] == 1:
            assert res['step_depends'] == sos_targets(sos_step('B'))
        if section.names[0][1] == 2:
            assert res['step_depends'] == sos_targets(sos_step('C1'),
                                                      sos_step('C2'))
예제 #4
0
 def test_remove_targets(self):
     '''Test sos_target.remove_targets()'''
     a = sos_targets(sos_step('1'), 'a.txt')._group(by=1)
     a.remove_targets(type=sos_step)
     self.assertEqual(len(a), 1)
     self.assertEqual(len(a.groups), 2)
     self.assertEqual(len(a._groups[0]._indexes), 0)
     self.assertEqual(len(a._groups[0]._labels), 0)
     self.assertEqual(a._groups[1]._indexes, [0])
     self.assertEqual(len(a._groups[1]._labels), 1)
예제 #5
0
 def test_remove_targets(self):
     """Test sos_target.remove_targets()"""
     a = sos_targets(sos_step("1"), "a.txt")._group(by=1)
     a.remove_targets(type=sos_step)
     self.assertEqual(len(a), 1)
     self.assertEqual(len(a.groups), 2)
     self.assertEqual(len(a._groups[0]._indexes), 0)
     self.assertEqual(len(a._groups[0]._labels), 0)
     self.assertEqual(a._groups[1]._indexes, [0])
     self.assertEqual(len(a._groups[1]._labels), 1)