예제 #1
0
def main():
    return composer.do(
        composer.retry(
            2,
            composer.action('generateEvenNumber',
                            {'action': generateEvenNumber})),
        composer.action('evenFailed', {'action': evenFailed}))
예제 #2
0
 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}
예제 #3
0
 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
         }
     }
예제 #4
0
 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'}
예제 #5
0
 def test_try_must_throw(self):
     activation = invoke(
         composer.do(composer.task(None), return_error_message),
         {'error': 'foo'})
     assert activation['response']['result'] == {'message': 'foo'}
예제 #6
0
 def test_error(self):
     activation = invoke(composer.do(set_error, return_error_message), {})
     assert activation['response']['result'] == {'message': 'foo'}
예제 #7
0
 def test_no_error(self):
     activation = invoke(composer.do(cond_true, return_error_message), {})
     assert activation['response']['result'] == {'value': True}