def test_str(set_cycling_type): set_cycling_type() trigger = TaskTrigger('name', '1', 'output', offset_is_absolute=True) assert str(trigger) == 'name[1]:output' trigger = TaskTrigger('name', '+P1', 'output') assert str(trigger) == 'name[+P1]:output' trigger = TaskTrigger('name', None, 'output') assert str(trigger) == 'name:output'
def test_str(cycling_mode): cycling_mode() one = get_point('1') two = get_point('2') trigger = TaskTrigger('name', '1', 'output', offset_is_absolute=True) assert str(trigger) == 'name[1]:output' trigger = TaskTrigger('name', '+P1', 'output') assert str(trigger) == 'name[+P1]:output' trigger = TaskTrigger('name', None, 'output') assert str(trigger) == 'name:output'
def test_check_for_list_of_lists_exp(): task_trigger = TaskTrigger('fake_task_name', None, None, 'fakeOutput') dependency = Dependency([task_trigger, '&', ['task', '&', 'another_task']], [task_trigger], False) actual = str(dependency) expected = ( "( fake_task_name:fakeOutput ) ( & ) ['task', '&', 'another_task']") assert actual == expected
def test_check_for_true_suicide(): task_trigger = TaskTrigger('fake_task_name', None, None, 'fakeOutput') dependency = Dependency([task_trigger, '&', task_trigger], [task_trigger], True) actual = str(dependency) expected = ( '! ( fake_task_name:fakeOutput ) ( & ) ( fake_task_name:fakeOutput )') assert actual == expected
def test_check_for_false_suicide(): task_trigger = TaskTrigger('fake_task_name', '1', None, 'fakeOutput') dependency = Dependency([task_trigger, '&', task_trigger], [task_trigger], False) actual = str(dependency) expected = ('( fake_task_name[1]:fakeOutput ) ( & ) ( fake_task_name[1]' ':fakeOutput )') assert actual == expected
def test_get_child_point(cycling_mode): cycling_mode() zero = get_point('0') one = get_point('1') two = get_point('2') p1 = get_sequence('P1', one) trigger = TaskTrigger('name', None, 'output') assert trigger.get_child_point(one, p1) == one assert trigger.get_child_point(two, p1) == two trigger = TaskTrigger('name', '+P1', 'output', offset_is_absolute=True) assert trigger.get_child_point(None, p1) == one trigger = TaskTrigger('name', '+P1', 'output', offset_is_from_icp=True) assert trigger.get_child_point(None, p1) == one trigger = TaskTrigger('name', '+P1', 'output', offset_is_irregular=True) assert trigger.get_child_point(one, p1) == zero trigger = TaskTrigger('name', '-P1', 'output', offset_is_irregular=True) assert trigger.get_child_point(one, p1) == two trigger = TaskTrigger('name', '+P1', 'output') assert trigger.get_child_point(one, None) == zero trigger = TaskTrigger('name', '-P1', 'output') assert trigger.get_child_point(one, None) == two
def test_get_point(cycling_mode): cycling_mode() one = get_point('1') two = get_point('2') trigger = TaskTrigger('name', '1', 'output', offset_is_absolute=True) assert trigger.get_point(None) == one trigger = TaskTrigger( 'name', '+P1', 'output', offset_is_from_icp=True, initial_point=one) assert trigger.get_point(None) == two trigger = TaskTrigger('name', '+P1', 'output') assert trigger.get_point(one) == two trigger = TaskTrigger('name', None, 'output') assert trigger.get_point(one) == one
def test_check_with_cycle_point(): task_trigger = TaskTrigger('fake_task_name', '1', None, 'fakeOutput') actual = str(task_trigger) expected = 'fake_task_name[1]:fakeOutput' assert actual == expected