def create_stubs(stubs_to_create=None):
 if (stubs_to_create is None):
  stubs_to_create = {}
 if (not isinstance(stubs_to_create, dict)):
  raise TypeError(('create_stub must be passed a dict, but a %s was given.' % type(stubs_to_create).__name__))
 def inner_stub_out(fn):
  @wraps(fn)
  def instance_stub_out(self, *args, **kwargs):
   for key in stubs_to_create:
    if (not (isinstance(stubs_to_create[key], tuple) or isinstance(stubs_to_create[key], list))):
     raise TypeError(('The values of the create_stub dict must be lists or tuples, but is a %s.' % type(stubs_to_create[key]).__name__))
    for value in stubs_to_create[key]:
     self.mox.StubOutWithMock(key, value)
   return fn(self, *args, **kwargs)
  return instance_stub_out
 return inner_stub_out

def create_stubs ( stubs_to_create = None ) : if ( stubs_to_create is None ) : stubs_to_create = { } if ( not isinstance ( stubs_to_create , dict ) ) : raise TypeError ( ( 'create_stub must be passed a dict, but a %s was given.' % type ( stubs_to_create ) . __name__ ) ) def inner_stub_out ( fn ) : @ wraps ( fn ) def instance_stub_out ( self , * args , ** kwargs ) : for key in stubs_to_create : if ( not ( isinstance ( stubs_to_create [ key ] , tuple ) or isinstance ( stubs_to_create [ key ] , list ) ) ) : raise TypeError ( ( 'The values of the create_stub dict must be lists or tuples, but is a %s.' % type ( stubs_to_create [ key ] ) . __name__ ) ) for value in stubs_to_create [ key ] : self . mox . StubOutWithMock ( key , value ) return fn ( self , * args , ** kwargs ) return instance_stub_out return inner_stub_out
decorator to simplify setting up multiple stubs at once via mox .