@@ -69,8 +69,9 @@ def _BuildLocations( start_line, start_column, end_line, end_column ):
6969
7070
7171class VimsupportTest ( TestCase ):
72+ @patch ( 'ycm.vimsupport.WinIDForWindow' , side_effect = range ( 1001 , 1010 ) )
7273 @patch ( 'vim.eval' , new_callable = ExtendedMock )
73- def test_SetLocationListsForBuffer_Current ( self , vim_eval ):
74+ def test_SetLocationListsForBuffer_Current ( self , vim_eval , * args ):
7475 diagnostics = [ {
7576 'bufnr' : 3 ,
7677 'filename' : 'some_filename' ,
@@ -84,10 +85,10 @@ def test_SetLocationListsForBuffer_Current( self, vim_eval ):
8485 vimsupport .SetLocationListsForBuffer ( 3 , diagnostics )
8586
8687 vim_eval .assert_has_exact_calls ( [
87- call ( 'setloclist( 1 , [], " ", { "title": "ycm_loc", '
88+ call ( 'setloclist( 1001 , [], " ", { "title": "ycm_loc", '
8889 '"items": [{"bufnr": 3, "filename": "some_filename", "lnum": 5, '
8990 '"col": 22, "type": "E", "valid": 1}] } )' ),
90- call ( 'getloclist( 1 , { "nr": "$", "id": 0 } ).id' ),
91+ call ( 'getloclist( 1001 , { "nr": "$", "id": 0 } ).id' ),
9192 ] )
9293
9394
@@ -127,8 +128,9 @@ def test_SetLocationListsForBuffer_NotVisible( self, vim_eval ):
127128 vim_eval .assert_not_called ()
128129
129130
131+ @patch ( 'ycm.vimsupport.WinIDForWindow' , side_effect = range ( 1001 , 1010 ) )
130132 @patch ( 'vim.eval' , new_callable = ExtendedMock , side_effect = [ - 1 , 1 ] )
131- def test_SetLocationListsForBuffer_MultipleWindows ( self , vim_eval ):
133+ def test_SetLocationListsForBuffer_MultipleWindows ( self , vim_eval , * args ):
132134 diagnostics = [ {
133135 'bufnr' : 3 ,
134136 'filename' : 'some_filename' ,
@@ -144,14 +146,15 @@ def test_SetLocationListsForBuffer_MultipleWindows( self, vim_eval ):
144146 vimsupport .SetLocationListsForBuffer ( 1 , diagnostics )
145147
146148 vim_eval .assert_has_exact_calls ( [
147- call ( 'setloclist( 2 , [], " ", { "title": "ycm_loc", "items": '
149+ call ( 'setloclist( 1001 , [], " ", { "title": "ycm_loc", "items": '
148150 f'{ json .dumps ( diagnostics ) } }} )' ),
149- call ( 'getloclist( 2 , { "nr": "$", "id": 0 } ).id' ),
151+ call ( 'getloclist( 1001 , { "nr": "$", "id": 0 } ).id' ),
150152 ] )
151153
152154
155+ @patch ( 'ycm.vimsupport.WinIDForWindow' , side_effect = range ( 1001 , 1010 ) )
153156 @patch ( 'vim.eval' , new_callable = ExtendedMock )
154- def test_SetLocationList ( self , vim_eval ):
157+ def test_SetLocationList ( self , vim_eval , * args ):
155158 diagnostics = [ {
156159 'bufnr' : 3 ,
157160 'filename' : 'some_filename' ,
@@ -165,15 +168,16 @@ def test_SetLocationList( self, vim_eval ):
165168 vimsupport .SetLocationList ( diagnostics )
166169
167170 vim_eval .assert_has_exact_calls ( [
168- call ( 'setloclist( 0 , [], " ", { "title": "ycm_loc", "items": [{"bufnr ": '
169- '3, "filename": "some_filename", "lnum": '
171+ call ( 'setloclist( 1001 , [], " ", { "title": "ycm_loc", "items": '
172+ '[{"bufnr": 3, "filename": "some_filename", "lnum": '
170173 '5, "col": 22, "type": "E", "valid": 1}] } )' ),
171- call ( 'getloclist( 0 , { "nr": "$", "id": 0 } ).id' ),
174+ call ( 'getloclist( 1001 , { "nr": "$", "id": 0 } ).id' ),
172175 ] )
173176
174177
178+ @patch ( 'ycm.vimsupport.WinIDForWindow' , side_effect = range ( 1001 , 1010 ) )
175179 @patch ( 'vim.eval' , new_callable = ExtendedMock )
176- def test_SetLocationList_NotCurrent ( self , vim_eval ):
180+ def test_SetLocationList_NotCurrent ( self , vim_eval , * args ):
177181 diagnostics = [ {
178182 'bufnr' : 3 ,
179183 'filename' : 'some_filename' ,
@@ -192,10 +196,10 @@ def test_SetLocationList_NotCurrent( self, vim_eval ):
192196 # This version does not check the current
193197 # buffer and just sets the current win
194198 vim_eval .assert_has_exact_calls ( [
195- call ( 'setloclist( 0 , [], " ", { "title": "ycm_loc", "items": [{"bufnr ": '
196- '3, "filename": "some_filename", "lnum": 5, "col": 22, '
199+ call ( 'setloclist( 1001 , [], " ", { "title": "ycm_loc", "items": '
200+ '[{"bufnr": 3, "filename": "some_filename", "lnum": 5, "col": 22, '
197201 '"type": "E", "valid": 1}] } )' ),
198- call ( 'getloclist( 0 , { "nr": "$", "id": 0 } ).id' ),
202+ call ( 'getloclist( 1001 , { "nr": "$", "id": 0 } ).id' ),
199203 ] )
200204
201205
@@ -2052,9 +2056,9 @@ def test_JumpToLocation_DifferentFile_Split_AllTabs_AlreadyOpened(
20522056 current_window = MagicMock ( buffer = current_buffer )
20532057 different_window = MagicMock ( buffer = different_buffer )
20542058 current_tab = MagicMock ( windows = [ current_window , different_window ] )
2055- with patch ( 'vim.tabpages' , [ current_tab ] ):
2056- with MockVimBuffers ( [ current_buffer , different_buffer ],
2057- [ current_buffer ] ) as vim :
2059+ with MockVimBuffers ( [ current_buffer , different_buffer ],
2060+ [ current_buffer ] ) as vim :
2061+ with patch ( 'vim.tabpages' , [ current_tab ] ):
20582062 vimsupport .JumpToLocation ( os .path .realpath ( 'different_uni¢𐍈d€' ),
20592063 2 ,
20602064 5 ,
@@ -2102,9 +2106,9 @@ def test_JumpToLocation_DifferentFile_NewOrExistingTab_AlreadyOpened(
21022106 current_window = MagicMock ( buffer = current_buffer )
21032107 different_window = MagicMock ( buffer = different_buffer )
21042108 current_tab = MagicMock ( windows = [ current_window , different_window ] )
2105- with patch ( 'vim.tabpages' , [ current_tab ] ):
2106- with MockVimBuffers ( [ current_buffer , different_buffer ],
2107- [ current_buffer ] ) as vim :
2109+ with MockVimBuffers ( [ current_buffer , different_buffer ],
2110+ [ current_buffer ] ) as vim :
2111+ with patch ( 'vim.tabpages' , [ current_tab ] ):
21082112 vimsupport .JumpToLocation ( os .path .realpath ( 'different_uni¢𐍈d€' ),
21092113 2 ,
21102114 5 ,
0 commit comments