def test_duplicate_keyword(self, func, exception): menu = {'command': 'test', 'function': func} mn = MenuNode(**menu) kwargs = [Kwarg('e', 'prompt'), Kwarg('e', 'prompt')] with pytest.raises(exception): mn._validate_function_args(kwargs)
def template_test(self, func, letters, number_args): args_packed = pack_args(letters, number_args) args, kwarg_objects = MenuNode._split_kwargs(args_packed) kwargs = {kw.key(): kw.value() for kw in kwarg_objects} print(kwargs) menu = {'command': 'test', 'function': func} mn = MenuNode(**menu) try: mn._function(*args, **kwargs) except TypeError: with pytest.raises(InvalidArgError): mn._validate_function_args(args_packed) else: # assert anything here? mn._validate_function_args(args_packed)