예제 #1
0
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']))
예제 #2
0
 def GetCompletionResponse(self):
     response = self._latest_completion_request.Response()
     response['completions'] = base.AdjustCandidateInsertionText(
         response['completions'])
     return response
예제 #3
0
def AdjustCandidateInsertionText_NothingAfterCursor_test():
  with MockTextAfterCursor( '' ):
    eq_( [ 'foofoo',
           'zobar' ],
         base.AdjustCandidateInsertionText( [ 'foofoo',
                                              'zobar' ] ) )
예제 #4
0
def AdjustCandidateInsertionText_NotSuffix_test():
  with MockTextAfterCursor( 'bar' ):
    eq_( [ { 'abbr': 'foofoo', 'word': 'foofoo' } ],
         base.AdjustCandidateInsertionText( [ 'foofoo' ] ) )
예제 #5
0
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test():
  with MockTextAfterCursor( 'bar zoo' ):
    eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
         base.AdjustCandidateInsertionText( [ 'foobar' ] ) )
예제 #6
0
def AdjustCandidateInsertionText_DontTouchAbbr_test():
  with MockTextAfterCursor( 'bar' ):
    eq_( [ { 'abbr': '1234', 'word': 'foo' } ],
         base.AdjustCandidateInsertionText(
           [ { 'abbr': '1234', 'word': 'foobar' } ] ) )
예제 #7
0
def AdjustCandidateInsertionText_DictInput_test():
  with MockTextAfterCursor( 'bar' ):
    eq_( [ { 'abbr': 'foobar', 'word': 'foo' } ],
         base.AdjustCandidateInsertionText(
           [ { 'word': 'foobar' } ] ) )
예제 #8
0
def AdjustCandidateInsertionText_NotSuffix_test():
    vimsupport.TextAfterCursor = MagicMock(return_value='bar')
    eq_([{
        'abbr': 'foofoo',
        'word': 'foofoo'
    }], base.AdjustCandidateInsertionText(['foofoo']))
예제 #9
0
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test():
    vimsupport.TextAfterCursor = MagicMock(return_value='bar zoo')
    eq_([{
        'abbr': 'foobar',
        'word': 'foo'
    }], base.AdjustCandidateInsertionText(['foobar']))
예제 #10
0
def AdjustCandidateInsertionText_NothingAfterCursor_test():
    vimsupport.TextAfterCursor = MagicMock(return_value='')
    eq_(['foofoo', 'zobar'],
        base.AdjustCandidateInsertionText(['foofoo', 'zobar']))
예제 #11
0
 def GetCompletionResponse(self):
     vim.eval("jedi#show_cache_signatures()")
     response = self._latest_completion_request.Response()
     response['completions'] = base.AdjustCandidateInsertionText(
         response['completions'])
     return response
예제 #12
0
def AdjustCandidateInsertionText_PlusInTextAfterCursor_test():
  with MockTextAfterCursor( 'bar+zoo' ):
    eq_( [ { 'word': 'foo',    'abbr': 'foobar' } ],
         base.AdjustCandidateInsertionText( [
           { 'word': 'foobar', 'abbr': '' } ] ) )
예제 #13
0
def AdjustCandidateInsertionText_NotSuffix_test():
  with MockTextAfterCursor( 'bar' ):
    assert_that( [ { 'word': 'foofoo', 'abbr': 'foofoo' } ],
                 equal_to( base.AdjustCandidateInsertionText( [
                   { 'word': 'foofoo', 'abbr': '' } ] ) ) )
예제 #14
0
def AdjustCandidateInsertionText_WhitespaceInTextAfterCursor_test():
  with MockTextAfterCursor( 'bar zoo' ):
    assert_that( [ { 'word': 'foo',    'abbr': 'foobar' } ],
                 equal_to( base.AdjustCandidateInsertionText( [
                             { 'word': 'foobar', 'abbr': '' } ] ) ) )
예제 #15
0
def AdjustCandidateInsertionText_DontTouchAbbr_test():
  with MockTextAfterCursor( 'bar' ):
    assert_that( [ { 'word': 'foo',    'abbr': '1234' } ],
                 equal_to( base.AdjustCandidateInsertionText( [
                   { 'word': 'foobar', 'abbr': '1234' } ] ) ) )