def test_parallel_state_creation(): parallel_state = Parallel('Parallel') parallel_state.add_branch(Pass('Branch 1')) parallel_state.add_branch(Pass('Branch 2')) parallel_state.add_branch(Pass('Branch 3')) assert parallel_state.type == 'Parallel' assert len(parallel_state.branches) == 3 assert parallel_state.to_dict() == { 'Type': 'Parallel', 'Branches': [ { 'StartAt': 'Branch 1', 'States': { 'Branch 1': { 'Type': 'Pass', 'End': True } } }, { 'StartAt': 'Branch 2', 'States': { 'Branch 2': { 'Type': 'Pass', 'End': True } } }, { 'StartAt': 'Branch 3', 'States': { 'Branch 3': { 'Type': 'Pass', 'End': True } } } ], 'End': True }
def test_parallel_state_add_catch_adds_catcher_to_catchers( catch, expected_catch): step = Parallel('Parallel') step.add_catch(catch) assert step.to_dict()['Catch'] == expected_catch
def test_parallel_state_add_retry_adds_retrier_to_retriers( retry, expected_retry): step = Parallel('Parallel') step.add_retry(retry) assert step.to_dict()['Retry'] == expected_retry
def test_parallel_state_constructor_with_catch_adds_catcher_to_catchers( catch, expected_catch): step = Parallel('Parallel', catch=catch) assert step.to_dict()['Catch'] == expected_catch
def test_parallel_state_constructor_with_retry_adds_retrier_to_retriers( retry, expected_retry): step = Parallel('Parallel', retry=retry) assert step.to_dict()['Retry'] == expected_retry