Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Call the underlying function safely, given a set of keyword
arguments.  If successful, the function return value (likely
None) will be returned.  If the underlying function raises an
exception, the return value will be the exception message,
unless an argparse Namespace object defining a 'debug'
attribute of True is provided; in this case, the exception
will be re-raised.

:param kwargs: A dictionary of keyword arguments to pass to
               the underlying function.(more...)

src/t/u/turnstile-HEAD/tests/unit/test_tools.py   turnstile(Download)
    def test_safe_call(self):
        func = mock.Mock(__doc__='', return_value='result')
        sa = tools.ScriptAdaptor(func)
 
        result = sa.safe_call(dict(a=1, b=2, c=3))
        sa = tools.ScriptAdaptor(func)
 
        result = sa.safe_call(dict(a=1, b=2, c=3))
 
        self.assertEqual(result, 'error')