Пример #1
0
def test_pipe_exception_handler():

    class MyException(Exception):
        pass

    with pytest.raises(MyException) as excinfo:

        with pipe_exception_handler('NAME'):

            raise MyException('boo hoo')

    assert excinfo.value.message == "boo hoo\n  in NAME"
Пример #2
0
 def composite(*args, **kwargs):
     with pipe_exception_handler('maybe ?| ' + name):
         result = first(*args, **kwargs)
         return None if result is None else second(result)
Пример #3
0
 def composite(*args, **kwargs):
     with pipe_exception_handler('pipe | ' + name):
         return second(first(*args, **kwargs))
Пример #4
0
 def composite(*args, **kwargs):
     with pipe_exception_handler('maybe ?| ' + name):
         result = first(*args, **kwargs)
         return None if result is None else second(result)
Пример #5
0
 def composite(*args, **kwargs):
     with pipe_exception_handler('pipe | ' + name):
         return second(first(*args, **kwargs))