def AdjustCandidateInsertionText_MultipleStrings_test(): with MockTextAfterCursor('bar'): eq_([ { 'abbr': 'foobar', 'word': 'foo' }, { 'abbr': 'zobar', 'word': 'zo' }, { 'abbr': 'qbar', 'word': 'q' }, { 'abbr': 'bar', 'word': '' }, ], base.AdjustCandidateInsertionText( ['foobar', 'zobar', 'qbar', 'bar']))
def GetCompletionResponse(self): response = self._latest_completion_request.Response() response['completions'] = base.AdjustCandidateInsertionText( response['completions']) return response
def AdjustCandidateInsertionText_NothingAfterCursor_test(): with MockTextAfterCursor( '' ): eq_( [ 'foofoo', 'zobar' ], base.AdjustCandidateInsertionText( [ 'foofoo', 'zobar' ] ) )
def AdjustCandidateInsertionText_NotSuffix_test(): with MockTextAfterCursor( 'bar' ): eq_( [ { 'abbr': 'foofoo', 'word': 'foofoo' } ], base.AdjustCandidateInsertionText( [ 'foofoo' ] ) )
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test(): with MockTextAfterCursor( 'bar zoo' ): eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ], base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
def AdjustCandidateInsertionText_DontTouchAbbr_test(): with MockTextAfterCursor( 'bar' ): eq_( [ { 'abbr': '1234', 'word': 'foo' } ], base.AdjustCandidateInsertionText( [ { 'abbr': '1234', 'word': 'foobar' } ] ) )
def AdjustCandidateInsertionText_DictInput_test(): with MockTextAfterCursor( 'bar' ): eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ], base.AdjustCandidateInsertionText( [ { 'word': 'foobar' } ] ) )
def AdjustCandidateInsertionText_NotSuffix_test(): vimsupport.TextAfterCursor = MagicMock(return_value='bar') eq_([{ 'abbr': 'foofoo', 'word': 'foofoo' }], base.AdjustCandidateInsertionText(['foofoo']))
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test(): vimsupport.TextAfterCursor = MagicMock(return_value='bar zoo') eq_([{ 'abbr': 'foobar', 'word': 'foo' }], base.AdjustCandidateInsertionText(['foobar']))
def AdjustCandidateInsertionText_NothingAfterCursor_test(): vimsupport.TextAfterCursor = MagicMock(return_value='') eq_(['foofoo', 'zobar'], base.AdjustCandidateInsertionText(['foofoo', 'zobar']))
def GetCompletionResponse(self): vim.eval("jedi#show_cache_signatures()") response = self._latest_completion_request.Response() response['completions'] = base.AdjustCandidateInsertionText( response['completions']) return response
def AdjustCandidateInsertionText_PlusInTextAfterCursor_test(): with MockTextAfterCursor( 'bar+zoo' ): eq_( [ { 'word': 'foo', 'abbr': 'foobar' } ], base.AdjustCandidateInsertionText( [ { 'word': 'foobar', 'abbr': '' } ] ) )
def AdjustCandidateInsertionText_NotSuffix_test(): with MockTextAfterCursor( 'bar' ): assert_that( [ { 'word': 'foofoo', 'abbr': 'foofoo' } ], equal_to( base.AdjustCandidateInsertionText( [ { 'word': 'foofoo', 'abbr': '' } ] ) ) )
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test(): with MockTextAfterCursor( 'bar zoo' ): assert_that( [ { 'word': 'foo', 'abbr': 'foobar' } ], equal_to( base.AdjustCandidateInsertionText( [ { 'word': 'foobar', 'abbr': '' } ] ) ) )
def AdjustCandidateInsertionText_DontTouchAbbr_test(): with MockTextAfterCursor( 'bar' ): assert_that( [ { 'word': 'foo', 'abbr': '1234' } ], equal_to( base.AdjustCandidateInsertionText( [ { 'word': 'foobar', 'abbr': '1234' } ] ) ) )