@contextlib.contextmanager
def MockVimBuffers(buffers, current_buffer, cursor_position=(1, 1)):
 if (current_buffer not in buffers):
  raise RuntimeError(u'Current buffer must be part of the buffers list.')
 with patch(u'vim.buffers', buffers):
  with patch(u'vim.current.buffer', current_buffer):
   with patch(u'vim.current.window.cursor', cursor_position):
    (yield)

@ contextlib . contextmanager def MockVimBuffers ( buffers , current_buffer , cursor_position = ( 1 , 1 ) ) : if ( current_buffer not in buffers ) : raise RuntimeError ( u'Current buffer must be part of the buffers list.' ) with patch ( u'vim.buffers' , buffers ) : with patch ( u'vim.current.buffer' , current_buffer ) : with patch ( u'vim.current.window.cursor' , cursor_position ) : ( yield )
simulates the vim buffers list |buffers| where |current_buffer| is the buffer displayed in the current window and |cursor_position| is the current cursor position .