def DetailedInfoTest(command, info): with patch( 'ycm.vimsupport.WriteToPreviewWindow') as write_to_preview: request = CommandRequest([command]) request._response = {'detailed_info': info} request.RunPostCommandActionsIfNeeded('topleft') write_to_preview.assert_called_with(info)
def GoToTest(command, response): with patch('ycm.vimsupport.JumpToLocation') as jump_to_location: request = CommandRequest([command]) request._response = response request.RunPostCommandActionsIfNeeded() jump_to_location.assert_called_with(response['filepath'], response['line_num'], response['column_num'])
def EmptyFixItTest(command): with patch("ycm.vimsupport.ReplaceChunks") as replace_chunks: with patch("ycm.vimsupport.EchoText") as echo_text: request = CommandRequest([command]) request._response = {"fixits": []} request.RunPostCommandActionsIfNeeded() echo_text.assert_called_with("No fixits found for current line") replace_chunks.assert_not_called()
def GoToListTest( command, response ): # Note: the detail of these called are tested by # GoToResponse_QuickFix_test, so here we just check that the right call is # made with patch( 'ycm.vimsupport.SetQuickFixList' ) as set_qf_list: request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded() ok_( set_qf_list.called )
def GoToTest( command, response ): with patch( 'ycm.vimsupport.JumpToLocation' ) as jump_to_location: request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded() jump_to_location.assert_called_with( response[ 'filepath' ], response[ 'line_num' ], response[ 'column_num' ] )
def FixItTest(command, response, chunks): with patch('ycm.vimsupport.ReplaceChunks') as replace_chunks: with patch('ycm.vimsupport.EchoText') as echo_text: request = CommandRequest([command]) request._response = response request.RunPostCommandActionsIfNeeded() replace_chunks.assert_called_with(chunks) echo_text.assert_not_called()
def GoToListTest(command, response): # Note: the detail of these called are tested by # GoToResponse_QuickFix_test, so here we just check that the right call is # made with patch('ycm.vimsupport.SetQuickFixList') as set_qf_list: request = CommandRequest([command]) request._response = response request.RunPostCommandActionsIfNeeded() ok_(set_qf_list.called)
def FixItTest( command, response, chunks ): with patch( 'ycm.vimsupport.ReplaceChunks' ) as replace_chunks: with patch( 'ycm.vimsupport.EchoText' ) as echo_text: request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded() replace_chunks.assert_called_with( chunks ) echo_text.assert_not_called()
def EmptyFixItTest(command): with patch('ycm.vimsupport.ReplaceChunks') as replace_chunks: with patch('ycm.vimsupport.EchoText') as echo_text: request = CommandRequest([command]) request._response = {'fixits': []} request.RunPostCommandActionsIfNeeded() echo_text.assert_called_with( 'No fixits found for current line') replace_chunks.assert_not_called()
def FixItTest( command, response, chunks, selection, silent ): with patch( 'ycm.vimsupport.ReplaceChunks' ) as replace_chunks: with patch( 'ycm.vimsupport.PostVimMessage' ) as post_vim_message: with patch( 'ycm.vimsupport.SelectFromList', return_value = selection ): request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded( 'leftabove' ) replace_chunks.assert_called_with( chunks, silent = silent ) post_vim_message.assert_not_called()
def FixItTest( command, response, chunks, selection ): with patch( 'ycm.vimsupport.ReplaceChunks' ) as replace_chunks: with patch( 'ycm.vimsupport.PostVimMessage' ) as post_vim_message: with patch( 'ycm.vimsupport.SelectFromList', return_value = selection ): request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded() replace_chunks.assert_called_with( chunks ) post_vim_message.assert_not_called()
def EmptyFixItTest(command): with patch('ycm.vimsupport.ReplaceChunks') as replace_chunks: with patch( 'ycm.vimsupport.PostVimMessage') as post_vim_message: request = CommandRequest([command]) request._response = {'fixits': []} request.RunPostCommandActionsIfNeeded('botright') post_vim_message.assert_called_with( 'No fixits found for current line', warning=False) replace_chunks.assert_not_called()
def EmptyFixItTest( command ): with patch( 'ycm.vimsupport.ReplaceChunks' ) as replace_chunks: with patch( 'ycm.vimsupport.PostVimMessage' ) as post_vim_message: request = CommandRequest( [ command ] ) request._response = { 'fixits': [] } request.RunPostCommandActionsIfNeeded() post_vim_message.assert_called_with( 'No fixits found for current line', warning = False ) replace_chunks.assert_not_called()
def _BasicResponseTest( command, response ): with patch( 'vim.command' ) as vim_command: request = CommandRequest( [ command ] ) request._response = response request.RunPostCommandActionsIfNeeded() vim_command.assert_called_with( "echom '{0}'".format( response ) )
def MessageTest(command, message): with patch('ycm.vimsupport.PostVimMessage') as post_vim_message: request = CommandRequest([command]) request._response = {'message': message} request.RunPostCommandActionsIfNeeded('rightbelow') post_vim_message.assert_called_with(message, warning=False)
def _BasicResponseTest(command, response): with patch('vim.command') as vim_command: request = CommandRequest([command]) request._response = response request.RunPostCommandActionsIfNeeded('belowright') vim_command.assert_called_with("echo '{0}'".format(response))
def MessageTest(command, message): with patch('ycm.vimsupport.EchoText') as echo_text: request = CommandRequest([command]) request._response = {'message': message} request.RunPostCommandActionsIfNeeded() echo_text.assert_called_with(message)
def DetailedInfoTest( command, info ): with patch( 'ycm.vimsupport.WriteToPreviewWindow' ) as write_to_preview: request = CommandRequest( [ command ] ) request._response = { 'detailed_info': info } request.RunPostCommandActionsIfNeeded() write_to_preview.assert_called_with( info )
def MessageTest( command, message ): with patch( 'ycm.vimsupport.EchoText' ) as echo_text: request = CommandRequest( [ command ] ) request._response = { 'message': message } request.RunPostCommandActionsIfNeeded() echo_text.assert_called_with( message )
def MessageTest( command, message ): with patch( 'ycm.vimsupport.PostVimMessage' ) as post_vim_message: request = CommandRequest( [ command ] ) request._response = { 'message': message } request.RunPostCommandActionsIfNeeded() post_vim_message.assert_called_with( message, warning = False )