def add_method(func, *combined_args):
 def wrapper(cls):
  for combined_arg in combined_args:
   if (len(combined_arg) == 2):
    args = combined_arg[0]
    kwargs = combined_arg[1]
   elif isinstance(combined_arg[0], Mapping):
    args = []
    kwargs = combined_arg[0]
   else:
    args = combined_arg[0]
    kwargs = {}
   test_method = make_method(func, args, kwargs)
   setattr(cls, test_method.__name__, test_method)
  return cls
 return wrapper

def add_method ( func , * combined_args ) : def wrapper ( cls ) : for combined_arg in combined_args : if ( len ( combined_arg ) == 2 ) : args = combined_arg [ 0 ] kwargs = combined_arg [ 1 ] elif isinstance ( combined_arg [ 0 ] , Mapping ) : args = [ ] kwargs = combined_arg [ 0 ] else : args = combined_arg [ 0 ] kwargs = { } test_method = make_method ( func , args , kwargs ) setattr ( cls , test_method . __name__ , test_method ) return cls return wrapper
add a test case via a class decorator .