diff --git a/python/ycm/diagnostic_interface.py b/python/ycm/diagnostic_interface.py index ac90ba0b..ca5976ad 100644 --- a/python/ycm/diagnostic_interface.py +++ b/python/ycm/diagnostic_interface.py @@ -59,7 +59,7 @@ class DiagnosticInterface( object ): def PopulateLocationList( self ): # Do nothing if loc list is already populated by diag_interface if not self._user_options[ 'always_populate_location_list' ]: - self._UpdateLocationList() + self._UpdateLocationLists() return bool( self._diagnostics ) @@ -77,7 +77,7 @@ class DiagnosticInterface( object ): self.UpdateMatches() if self._user_options[ 'always_populate_location_list' ]: - self._UpdateLocationList() + self._UpdateLocationLists() def _ApplyDiagnosticFilter( self, diags ): @@ -119,8 +119,8 @@ class DiagnosticInterface( object ): return count - def _UpdateLocationList( self ): - vimsupport.SetLocationListForBuffer( + def _UpdateLocationLists( self ): + vimsupport.SetLocationListsForBuffer( self._bufnr, vimsupport.ConvertDiagnosticsToQfList( self._diagnostics ) ) @@ -129,46 +129,28 @@ class DiagnosticInterface( object ): if not self._user_options[ 'enable_diagnostic_highlighting' ]: return - matches_to_remove = vimsupport.GetDiagnosticMatchesInCurrentWindow() + with vimsupport.CurrentWindow(): + for window in vimsupport.GetWindowsForBufferNumber( self._bufnr ): + vimsupport.SwitchWindow( window ) - for diags in itervalues( self._line_to_diags ): - # Insert squiggles in reverse order so that errors overlap warnings. - for diag in reversed( diags ): - patterns = [] + matches_to_remove = vimsupport.GetDiagnosticMatchesInCurrentWindow() - group = ( 'YcmErrorSection' if _DiagnosticIsError( diag ) else - 'YcmWarningSection' ) + for diags in itervalues( self._line_to_diags ): + # Insert squiggles in reverse order so that errors overlap warnings. + for diag in reversed( diags ): + group = ( 'YcmErrorSection' if _DiagnosticIsError( diag ) else + 'YcmWarningSection' ) - location_extent = diag[ 'location_extent' ] - if location_extent[ 'start' ][ 'line_num' ] <= 0: - location = diag[ 'location' ] - patterns.append( vimsupport.GetDiagnosticMatchPattern( - location[ 'line_num' ], - location[ 'column_num' ] ) ) - else: - patterns.append( vimsupport.GetDiagnosticMatchPattern( - location_extent[ 'start' ][ 'line_num' ], - location_extent[ 'start' ][ 'column_num' ], - location_extent[ 'end' ][ 'line_num' ], - location_extent[ 'end' ][ 'column_num' ] ) ) + for pattern in _ConvertDiagnosticToMatchPatterns( diag ): + # The id doesn't matter for matches that we may add. + match = vimsupport.DiagnosticMatch( 0, group, pattern ) + try: + matches_to_remove.remove( match ) + except ValueError: + vimsupport.AddDiagnosticMatch( match ) - for diag_range in diag[ 'ranges' ]: - patterns.append( vimsupport.GetDiagnosticMatchPattern( - diag_range[ 'start' ][ 'line_num' ], - diag_range[ 'start' ][ 'column_num' ], - diag_range[ 'end' ][ 'line_num' ], - diag_range[ 'end' ][ 'column_num' ] ) ) - - for pattern in patterns: - # The id doesn't matter for matches that we may add. - match = vimsupport.DiagnosticMatch( 0, group, pattern ) - try: - matches_to_remove.remove( match ) - except ValueError: - vimsupport.AddDiagnosticMatch( match ) - - for match in matches_to_remove: - vimsupport.RemoveDiagnosticMatch( match ) + for match in matches_to_remove: + vimsupport.RemoveDiagnosticMatch( match ) def _UpdateSigns( self ): @@ -221,3 +203,29 @@ def _NormalizeDiagnostic( diag ): location[ 'column_num' ] = ClampToOne( location[ 'column_num' ] ) location[ 'line_num' ] = ClampToOne( location[ 'line_num' ] ) return diag + + +def _ConvertDiagnosticToMatchPatterns( diagnostic ): + patterns = [] + + location_extent = diagnostic[ 'location_extent' ] + if location_extent[ 'start' ][ 'line_num' ] <= 0: + location = diagnostic[ 'location' ] + patterns.append( vimsupport.GetDiagnosticMatchPattern( + location[ 'line_num' ], + location[ 'column_num' ] ) ) + else: + patterns.append( vimsupport.GetDiagnosticMatchPattern( + location_extent[ 'start' ][ 'line_num' ], + location_extent[ 'start' ][ 'column_num' ], + location_extent[ 'end' ][ 'line_num' ], + location_extent[ 'end' ][ 'column_num' ] ) ) + + for diagnostic_range in diagnostic[ 'ranges' ]: + patterns.append( vimsupport.GetDiagnosticMatchPattern( + diagnostic_range[ 'start' ][ 'line_num' ], + diagnostic_range[ 'start' ][ 'column_num' ], + diagnostic_range[ 'end' ][ 'line_num' ], + diagnostic_range[ 'end' ][ 'column_num' ] ) ) + + return patterns diff --git a/python/ycm/tests/client/base_request_test.py b/python/ycm/tests/client/base_request_test.py index 66dd5ef5..997313a0 100644 --- a/python/ycm/tests/client/base_request_test.py +++ b/python/ycm/tests/client/base_request_test.py @@ -34,7 +34,7 @@ from ycm.client.base_request import BuildRequestData return_value = '/some/dir' ) def BuildRequestData_AddWorkingDir_test( *args ): current_buffer = VimBuffer( 'foo' ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 1 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): assert_that( BuildRequestData(), has_entry( 'working_dir', '/some/dir' ) ) @@ -42,6 +42,6 @@ def BuildRequestData_AddWorkingDir_test( *args ): return_value = '/some/dir' ) def BuildRequestData_AddWorkingDirWithFileName_test( *args ): current_buffer = VimBuffer( 'foo' ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 1 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): assert_that( BuildRequestData( current_buffer.number ), has_entry( 'working_dir', '/some/dir' ) ) diff --git a/python/ycm/tests/command_test.py b/python/ycm/tests/command_test.py index 53909047..bbe2a9ba 100644 --- a/python/ycm/tests/command_test.py +++ b/python/ycm/tests/command_test.py @@ -34,7 +34,7 @@ from ycm.tests import YouCompleteMeInstance @YouCompleteMeInstance( { 'g:ycm_extra_conf_vim_data': [ 'tempname()' ] } ) def SendCommandRequest_ExtraConfVimData_Works_test( ycm ): current_buffer = VimBuffer( 'buffer' ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with patch( 'ycm.youcompleteme.SendCommandRequest' ) as send_request: ycm.SendCommandRequest( [ 'GoTo' ], 'python', False, 1, 1 ) assert_that( @@ -59,7 +59,7 @@ def SendCommandRequest_ExtraConfVimData_Works_test( ycm ): @YouCompleteMeInstance( { 'g:ycm_extra_conf_vim_data': [ 'undefined_value' ] } ) def SendCommandRequest_ExtraConfData_UndefinedValue_test( ycm ): current_buffer = VimBuffer( 'buffer' ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with patch( 'ycm.youcompleteme.SendCommandRequest' ) as send_request: ycm.SendCommandRequest( [ 'GoTo' ], 'python', False, 1, 1 ) assert_that( @@ -82,7 +82,7 @@ def SendCommandRequest_ExtraConfData_UndefinedValue_test( ycm ): def SendCommandRequest_BuildRange_NoVisualMarks_test( ycm, *args ): current_buffer = VimBuffer( 'buffer', contents = [ 'first line', 'second line' ] ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with patch( 'ycm.youcompleteme.SendCommandRequest' ) as send_request: ycm.SendCommandRequest( [ 'GoTo' ], 'python', True, 1, 2 ) send_request.assert_called_once_with( @@ -114,7 +114,7 @@ def SendCommandRequest_BuildRange_VisualMarks_test( ycm, *args ): 'second line' ], visual_start = [ 1, 4 ], visual_end = [ 2, 8 ] ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with patch( 'ycm.youcompleteme.SendCommandRequest' ) as send_request: ycm.SendCommandRequest( [ 'GoTo' ], 'python', True, 1, 2 ) send_request.assert_called_once_with( diff --git a/python/ycm/tests/completion_test.py b/python/ycm/tests/completion_test.py index cb15d2dc..00ac7cf3 100644 --- a/python/ycm/tests/completion_test.py +++ b/python/ycm/tests/completion_test.py @@ -66,7 +66,7 @@ def SendCompletionRequest_UnicodeWorkingDirectory_test( ycm ): return { 'completions': [], 'completion_start_column': 1 } with CurrentWorkingDirectory( unicode_dir ): - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with MockCompletionRequest( ServerResponse ): ycm.SendCompletionRequest() ok_( ycm.CompletionRequestReady() ) @@ -106,7 +106,7 @@ def SendCompletionRequest_ResponseContainingError_test( ycm, post_vim_message ): } ] } - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with MockCompletionRequest( ServerResponse ): ycm.SendCompletionRequest() ok_( ycm.CompletionRequestReady() ) @@ -138,7 +138,7 @@ def SendCompletionRequest_ErrorFromServer_test( ycm, post_vim_message, logger ): current_buffer = VimBuffer( 'buffer' ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): with MockCompletionRequest( ServerError( 'Server error' ) ): ycm.SendCompletionRequest() ok_( ycm.CompletionRequestReady() ) diff --git a/python/ycm/tests/event_notification_test.py b/python/ycm/tests/event_notification_test.py index 7604fb92..a798dc90 100644 --- a/python/ycm/tests/event_notification_test.py +++ b/python/ycm/tests/event_notification_test.py @@ -57,10 +57,9 @@ def MockArbitraryBuffer( filetype ): # Arbitrary, but valid, single buffer open. current_buffer = VimBuffer( os.path.realpath( 'TEST_BUFFER' ), - window = 1, filetype = filetype ) - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): yield @@ -402,7 +401,7 @@ def EventNotification_FileReadyToParse_TagFiles_UnicodeWorkingDirectory_test( with patch( 'ycm.client.event_notification.EventNotification.' 'PostDataToHandlerAsync' ) as post_data_to_handler_async: with CurrentWorkingDirectory( unicode_dir ): - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 5 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 5 ) ): ycm.OnFileReadyToParse() assert_that( @@ -455,7 +454,7 @@ def EventNotification_BufferVisit_BuildRequestForCurrentAndUnsavedBuffers_test( with patch( 'ycm.client.event_notification.EventNotification.' 'PostDataToHandlerAsync' ) as post_data_to_handler_async: with MockVimBuffers( [ current_buffer, modified_buffer, unmodified_buffer ], - current_buffer, + [ current_buffer ], ( 1, 5 ) ): ycm.OnBufferVisit() @@ -503,7 +502,8 @@ def EventNotification_BufferUnload_BuildRequestForDeletedAndUnsavedBuffers_test( with patch( 'ycm.client.event_notification.EventNotification.' 'PostDataToHandlerAsync' ) as post_data_to_handler_async: - with MockVimBuffers( [ current_buffer, deleted_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer, deleted_buffer ], + [ current_buffer ] ): ycm.OnBufferUnload( deleted_buffer.number ) assert_that( @@ -543,7 +543,7 @@ def EventNotification_FileReadyToParse_SyntaxKeywords_SeedWithCache_test( with patch( 'ycm.client.event_notification.EventNotification.' 'PostDataToHandlerAsync' ) as post_data_to_handler_async: - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): ycm.OnFileReadyToParse() assert_that( # Positional arguments passed to PostDataToHandlerAsync. @@ -578,7 +578,7 @@ def EventNotification_FileReadyToParse_SyntaxKeywords_ClearCacheIfRestart_test( with patch( 'ycm.client.event_notification.EventNotification.' 'PostDataToHandlerAsync' ) as post_data_to_handler_async: - with MockVimBuffers( [ current_buffer ], current_buffer ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ] ): ycm.OnFileReadyToParse() assert_that( # Positional arguments passed to PostDataToHandlerAsync. diff --git a/python/ycm/tests/omni_completer_test.py b/python/ycm/tests/omni_completer_test.py index 81cd881e..9ddd9c52 100644 --- a/python/ycm/tests/omni_completer_test.py +++ b/python/ycm/tests/omni_completer_test.py @@ -52,7 +52,7 @@ def OmniCompleter_GetCompletions_Cache_List_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 5 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 5 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -76,7 +76,7 @@ def OmniCompleter_GetCompletions_Cache_ListFilter_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -100,7 +100,7 @@ def OmniCompleter_GetCompletions_NoCache_List_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 5 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 5 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -124,7 +124,7 @@ def OmniCompleter_GetCompletions_NoCache_ListFilter_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() # Actual result is that the results are not filtered, as we expect the # omnifunc or vim itself to do this filtering. @@ -150,7 +150,7 @@ def OmniCompleter_GetCompletions_NoCache_UseFindStart_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() # Actual result is that the results are not filtered, as we expect the # omnifunc or vim itself to do this filtering. @@ -176,7 +176,7 @@ def OmniCompleter_GetCompletions_Cache_UseFindStart_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() # There are no results because the query 'test.t' doesn't match any # candidate (and cache_omnifunc=1, so we FilterAndSortCandidates). @@ -202,7 +202,7 @@ def OmniCompleter_GetCompletions_Cache_Object_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -241,7 +241,7 @@ def OmniCompleter_GetCompletions_Cache_ObjectList_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 7 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 7 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -286,7 +286,7 @@ def OmniCompleter_GetCompletions_NoCache_ObjectList_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 7 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 7 ) ): ycm.SendCompletionRequest() # We don't filter the result - we expect the omnifunc to do that # based on the query we supplied (Note: that means no fuzzy matching!). @@ -339,7 +339,7 @@ def OmniCompleter_GetCompletions_Cache_ObjectListObject_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 7 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 7 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -384,7 +384,7 @@ def OmniCompleter_GetCompletions_NoCache_ObjectListObject_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 7 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 7 ) ): ycm.SendCompletionRequest() # No FilterAndSortCandidates for cache_omnifunc=0 (we expect the omnifunc # to do the filtering?) @@ -422,7 +422,7 @@ def OmniCompleter_GetCompletions_Cache_List_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 12 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 12 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -448,7 +448,7 @@ def OmniCompleter_GetCompletions_NoCache_List_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 12 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 12 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -474,7 +474,7 @@ def OmniCompleter_GetCompletions_Cache_List_Filter_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 17 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 17 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -498,7 +498,7 @@ def OmniCompleter_GetCompletions_NoCache_List_Filter_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 17 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 17 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -537,7 +537,7 @@ def OmniCompleter_GetCompletions_Cache_ObjectList_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 17 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 17 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -591,7 +591,7 @@ def OmniCompleter_GetCompletions_Cache_ObjectListObject_Unicode_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 13 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 13 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -634,7 +634,7 @@ def OmniCompleter_GetCompletions_RestoreCursorPositionAfterOmnifuncCall_test( filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 3, 5 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 3, 5 ) ): ycm.SendCompletionRequest() assert_that( vimsupport.CurrentLineAndColumn(), @@ -662,7 +662,7 @@ def OmniCompleter_GetCompletions_NoCache_NoSemanticTrigger_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 3 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 3 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -686,7 +686,7 @@ def OmniCompleter_GetCompletions_NoCache_ForceSemantic_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 3 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 3 ) ): ycm.SendCompletionRequest( force_semantic = True ) assert_that( ycm.GetCompletionResponse(), @@ -712,7 +712,7 @@ def OmniCompleter_GetCompletions_FiletypeDisabled_SemanticTrigger_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -740,7 +740,7 @@ def OmniCompleter_GetCompletions_AllFiletypesDisabled_SemanticTrigger_test( filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest() assert_that( ycm.GetCompletionResponse(), @@ -766,7 +766,7 @@ def OmniCompleter_GetCompletions_FiletypeDisabled_ForceSemantic_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest( force_semantic = True ) assert_that( ycm.GetCompletionResponse(), @@ -792,7 +792,7 @@ def OmniCompleter_GetCompletions_AllFiletypesDisabled_ForceSemantic_test( ycm ): filetype = FILETYPE, omnifunc = Omnifunc ) - with MockVimBuffers( [ current_buffer ], current_buffer, ( 1, 6 ) ): + with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 6 ) ): ycm.SendCompletionRequest( force_semantic = True ) assert_that( ycm.GetCompletionResponse(), diff --git a/python/ycm/tests/test_utils.py b/python/ycm/tests/test_utils.py index b9c4e515..2a6dd624 100644 --- a/python/ycm/tests/test_utils.py +++ b/python/ycm/tests/test_utils.py @@ -22,6 +22,7 @@ from __future__ import absolute_import # Not installing aliases from python-future; it's unreliable and slow. from builtins import * # noqa +from collections import defaultdict from future.utils import iteritems, PY2 from mock import DEFAULT, MagicMock, patch from hamcrest import assert_that, equal_to @@ -70,7 +71,7 @@ LET_REGEX = re.compile( '^let (?P