parameters: (self, obj, attr_name, use_mock_anything=False)
docstring: Replace a method, attribute, etc. with a Mock.
  
      This will replace a class or module with a MockObject, and everything else
      (method, function, etc) with a MockAnything.  This can be overridden to
      always use a MockAnything by setting use_mock_anything to True.
  
      Args:
        obj: A Python object (class, module, instance, callable).
        attr_name: str.  The name of the attribute to replace with a mock.
        use_mock_anything: bool. True if a MockAnything should be used regardless
          of the type of attribute.
docstring_summary: Replace a method, attribute, etc. with a Mock.
docstring_tokens: Replace a method attribute etc . with a Mock .
function: def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
      """Replace a method, attribute, etc. with a Mock.
  
      This will replace a class or module with a MockObject, and everything else
      (method, function, etc) with a MockAnything.  This can be overridden to
      always use a MockAnything by setting use_mock_anything to True.
  
      Args:
        obj: A Python object (class, module, instance, callable).
        attr_name: str.  The name of the attribute to replace with a mock.
        use_mock_anything: bool. True if a MockAnything should be used regardless
          of the type of attribute.
      """
  
      attr_to_replace = getattr(obj, attr_name)
      if type(attr_to_replace) in self._USE_MOCK_OBJECT and not use_mock_anything:
        stub = self.CreateMock(attr_to_replace)
      else:
        stub = self.CreateMockAnything()
  
      self.stubs.Set(obj, attr_name, stub)
function_tokens: def StubOutWithMock ( self , obj , attr_name , use_mock_anything = False ) : attr_to_replace = getattr ( obj , attr_name ) if type ( attr_to_replace ) in self . _USE_MOCK_OBJECT and not use_mock_anything : stub = self . CreateMock ( attr_to_replace ) else : stub = self . CreateMockAnything ( ) self . stubs . Set ( obj , attr_name , stub )