def for_orders(orders, name='order'):
 def decorator(impl):
  @functools.wraps(impl)
  def test_func(self, *args, **kw):
   for order in orders:
    try:
     kw[name] = order
     impl(self, *args, **kw)
    except Exception:
     print(name, 'is', order)
     raise
  return test_func
 return decorator

def for_orders ( orders , name = 'order' ) : def decorator ( impl ) : @ functools . wraps ( impl ) def test_func ( self , * args , ** kw ) : for order in orders : try : kw [ name ] = order impl ( self , * args , ** kw ) except Exception : print ( name , 'is' , order ) raise return test_func return decorator
decorator to parameterize tests with order .