예제 #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
파일: expect.py 프로젝트: jfwood/Specter
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
파일: expect.py 프로젝트: jfwood/Specter
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)