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))
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
Exemple #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
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
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
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
def test_math_wrap(value, result):
    assert apply_meta(excel_math_func(lambda x: x),
                      name_space={})[0](value) == result
def test_math_wrap_domain_error():
    func = apply_meta(excel_math_func(lambda x: math.log(x)))[0]
    assert func(-1) == NUM_ERROR
def test_math_wrap(value, result):
    assert apply_meta(excel_math_func(lambda x: x))[0](value) == result