def main(): return composer.do( composer.retry( 2, composer.action('generateEvenNumber', {'action': generateEvenNumber})), composer.action('evenFailed', {'action': evenFailed}))
def test_let_let_try_mask(self): activation = invoke( composer.let({'x': 42}, composer.let({'x': 69}, composer.do(composer.mask(get_x), noop)))) assert activation['response']['result'] == {'value': 42}
def test_retain(self): activation = invoke(composer.retain(composer.do(set_p_4, None)), {'n': 3}) assert activation['response']['result'] == { 'params': { 'n': 3 }, 'result': { 'p': 4 } }
def test_if_must_throw(self): activation = invoke( composer.do(composer.when(composer.literal(False), None), return_error_message), {'error': 'foo'}) assert activation['response']['result'] == {'message': 'foo'}
def test_try_must_throw(self): activation = invoke( composer.do(composer.task(None), return_error_message), {'error': 'foo'}) assert activation['response']['result'] == {'message': 'foo'}
def test_error(self): activation = invoke(composer.do(set_error, return_error_message), {}) assert activation['response']['result'] == {'message': 'foo'}
def test_no_error(self): activation = invoke(composer.do(cond_true, return_error_message), {}) assert activation['response']['result'] == {'value': True}