def instance_mock(request, cls, name=None, spec_set=True, **kwargs):
 name = (name if (name is not None) else request.fixturename)
 return create_autospec(cls, _name=name, spec_set=spec_set, instance=True, **kwargs)

def instance_mock ( request , cls , name = None , spec_set = True , ** kwargs ) : name = ( name if ( name is not None ) else request . fixturename ) return create_autospec ( cls , _name = name , spec_set = spec_set , instance = True , ** kwargs )
return a mock for an instance of *cls* that draws its spec from the class and does not allow new attributes to be set on the instance .