@contextlib.contextmanager
def MockEventNotification(response_method, native_filetype_completer=True):
 with patch(u'ycm.client.base_request.BaseRequest.PostDataToHandlerAsync', return_value=MagicMock(return_value=True)):
  with patch(u'ycm.client.event_notification.JsonFromFuture', side_effect=response_method):
   with patch(u'ycm.youcompleteme.YouCompleteMe.FiletypeCompleterExistsForFiletype', return_value=native_filetype_completer):
    (yield)

@ contextlib . contextmanager def MockEventNotification ( response_method , native_filetype_completer = True ) : with patch ( u'ycm.client.base_request.BaseRequest.PostDataToHandlerAsync' , return_value = MagicMock ( return_value = True ) ) : with patch ( u'ycm.client.event_notification.JsonFromFuture' , side_effect = response_method ) : with patch ( u'ycm.youcompleteme.YouCompleteMe.FiletypeCompleterExistsForFiletype' , return_value = native_filetype_completer ) : ( yield )
mock out the eventnotification client request object .