def test_prepare_catch_exception_and_return_it_in_tuple(): f = Mock(side_effect=Exception) fn = prepare(f) result = fn() assert result[0] is None assert isinstance(result[1], Exception)
def test_prepare_return_result_from_given_function_in_tuple(): f = Mock() fn = prepare(f) result = fn() assert result[0] == f.return_value assert result[1] is None
def _create_password_validator(app): return compose( prepare( compose( lambda app: app.config.get('MUSERS_PASSWORD_VALIDATOR'), import_string ) ), catch(ImportError, _default_validator), catch(RuntimeError, _default_validator), get_or_reraise )(app)