Пример #1
0
def require(obj, caller_args=[]):
    """ Primary method for test assertions in Specter
    :param obj: The evaluated target object
    :param caller_args: Is only used when using expecting a raised Exception
    """
    src_line = get_called_src_line(use_child_attr='__spec__')
    src_params = get_expect_param_strs(src_line)
    require_obj = RequireAssert(obj, src_params=src_params,
                                caller_args=caller_args)
    _add_expect_to_wrapper(require_obj)
    return require_obj
Пример #2
0
def require(obj):
    src_params = get_expect_param_strs(get_called_src_line())
    require_obj = RequireAssert(obj, src_params=src_params)
    _add_expect_to_wrapper(require_obj)
    return require_obj
Пример #3
0
def expect(obj):
    src_params = get_expect_param_strs(get_called_src_line())
    expect_obj = ExpectAssert(obj, src_params=src_params)
    _add_expect_to_wrapper(expect_obj)
    return expect_obj
Пример #4
0
 def test_get_called_src_line_error(self):
     handled = util.get_called_src_line()
     self.assertIsNone(handled)