parameters: (self, *params, **named_params)
return_statement: return mock_method(*params, **named_params)
docstring: Provide custom logic for mocking classes that are callable.
docstring_summary: Provide custom logic for mocking classes that are callable.
docstring_tokens: Provide custom logic for mocking classes that are callable .
function: def __call__(self, *params, **named_params):
          """Provide custom logic for mocking classes that are callable."""
  
          # Verify the class we are mocking is callable.
          is_callable = hasattr(self._class_to_mock, '__call__')
          if not is_callable:
              raise TypeError('Not callable')
  
          # Because the call is happening directly on this object instead of
          # a method, the call on the mock method is made right here
  
          # If we are mocking a Function, then use the function, and not the
          # __call__ method
          method = None
          if type(self._class_to_mock) in (types.FunctionType, types.MethodType):
              method = self._class_to_mock
          else:
              method = getattr(self._class_to_mock, '__call__')
          mock_method = self._CreateMockMethod('__call__', method_to_mock=method)
  
          return mock_method(*params, **named_params)
function_tokens: def __call__ ( self , * params , * * named_params ) : # Verify the class we are mocking is callable. is_callable = hasattr ( self . _class_to_mock , '__call__' ) if not is_callable : raise TypeError ( 'Not callable' ) # Because the call is happening directly on this object instead of # a method, the call on the mock method is made right here # If we are mocking a Function, then use the function, and not the # __call__ method method = None if type ( self . _class_to_mock ) in ( types . FunctionType , types . MethodType ) : method = self . _class_to_mock else : method = getattr ( self . _class_to_mock , '__call__' ) mock_method = self . _CreateMockMethod ( '__call__' , method_to_mock = method ) return mock_method ( * params , * * named_params )