예제 #1
0
 def test_invalid_arg(self):
     try:
         composer.literal(lambda x: x)
         assert False
     except composer.ComposerError as error:
         assert error.message.startswith('Invalid argument')
예제 #2
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'}
예제 #3
0
 def test_boolean(self):
     activation = invoke(composer.literal(True))
     assert activation['response']['result'] == {'value': True}
예제 #4
0
 def test_number(self):
     activation = invoke(composer.literal(42))
     assert activation['response']['result'] == {'value': 42}
 def test_function_invalid(self):
     try:
         composer.literal(lambda: {})
     except composer.ComposerError as error:
         assert error.message.startswith('Invalid argument')
 def test_dict(self):
     composer.literal({'foo': 42})
 def test_string(self):
     composer.literal('foo')
 def test_number(self):
     composer.literal(42)
 def test_boolean(self):
     composer.literal(True)