コード例 #1
0
def test_apply_meta_kwargs():
    def a_test_func(**x):
        pass

    with pytest.raises(
            RuntimeError,
            match=r'Function a_test_func: \*\*kwargs not allowed in signature'
    ):
        apply_meta(excel_helper()(a_test_func))
コード例 #2
0
def test_apply_meta_nothing_active():

    def a_test_func(x):
        return x

    func = apply_meta(excel_helper(err_str_params=None)(a_test_func))[0]
    assert func == a_test_func
コード例 #3
0
def test_apply_meta_nothing_active():

    def a_test_func(x):
        return x

    func = apply_meta(excel_helper(err_str_params=None)(a_test_func))[0]
    assert func == a_test_func
コード例 #4
0
def test_apply_meta_nothing_active():
    def a_test_func(x):
        return x

    func = apply_meta(excel_helper(err_str_params=None,
                                   ref_params=-1)(a_test_func),
                      name_space={})[0]
    assert func == a_test_func
コード例 #5
0
def test_ref_wrap(value, result):
    def r_test(*args):
        return args

    name_space = locals()
    name_space['_R_'] = lambda a: f'R:{a}'
    name_space['_C_'] = lambda a: f'C:{a}'

    func = apply_meta(excel_helper(ref_params=1)(r_test),
                      name_space=name_space)[0]
    assert func(*value) == result
コード例 #6
0
def test_math_wrap_domain_error():
    func = apply_meta(excel_math_func(lambda x: math.log(x)), name_space={})[0]
    assert func(-1) == NUM_ERROR
コード例 #7
0
def test_math_wrap(value, result):
    assert apply_meta(excel_math_func(lambda x: x),
                      name_space={})[0](value) == result
コード例 #8
0
def test_math_wrap_domain_error():
    func = apply_meta(excel_math_func(lambda x: math.log(x)))[0]
    assert func(-1) == NUM_ERROR
コード例 #9
0
def test_math_wrap(value, result):
    assert apply_meta(excel_math_func(lambda x: x))[0](value) == result