parameters: (self, key)
return_statement: return self._CreateMockMethod('__getitem__')(key)
docstring: Provide custom logic for mocking classes that are subscriptable.
  
      Args:
        key: Key to return the value for.
  
      Returns:
        Expected return value in replay mode.  A MockMethod object for the
        __getitem__ method that has already been called if not in replay mode.
  
      Raises:
        TypeError if the underlying class is not subscriptable.
        UnexpectedMethodCallError if the object does not expect the call to
          __setitem__.
docstring_summary: Provide custom logic for mocking classes that are subscriptable.
docstring_tokens: Provide custom logic for mocking classes that are subscriptable .
function: def __getitem__(self, key):
      """Provide custom logic for mocking classes that are subscriptable.
  
      Args:
        key: Key to return the value for.
  
      Returns:
        Expected return value in replay mode.  A MockMethod object for the
        __getitem__ method that has already been called if not in replay mode.
  
      Raises:
        TypeError if the underlying class is not subscriptable.
        UnexpectedMethodCallError if the object does not expect the call to
          __setitem__.
  
      """
      getitem = self._class_to_mock.__dict__.get('__getitem__', None)
  
      # Verify the class supports item assignment.
      if getitem is None:
        raise TypeError('unsubscriptable object')
  
      # If we are in replay mode then simply call the mock __getitem__ method.
      if self._replay_mode:
        return MockMethod('__getitem__', self._expected_calls_queue,
                          self._replay_mode)(key)
  
  
      # Otherwise, create a mock method __getitem__.
      return self._CreateMockMethod('__getitem__')(key)
function_tokens: def __getitem__ ( self , key ) : getitem = self . _class_to_mock . __dict__ . get ( '__getitem__' , None ) # Verify the class supports item assignment. if getitem is None : raise TypeError ( 'unsubscriptable object' ) # If we are in replay mode then simply call the mock __getitem__ method. if self . _replay_mode : return MockMethod ( '__getitem__' , self . _expected_calls_queue , self . _replay_mode ) ( key ) # Otherwise, create a mock method __getitem__. return self . _CreateMockMethod ( '__getitem__' ) ( key )