27
27
28
28
class CommandTest ( TestCase ):
29
29
@YouCompleteMeInstance ( { 'g:ycm_extra_conf_vim_data' : [ 'tempname()' ] } )
30
- def test_SendCommandRequest_ExtraConfVimData_Works ( self , ycm ):
30
+ def test_SendCommandRequestAsync_ExtraConfVimData_Works ( self , ycm ):
31
31
current_buffer = VimBuffer ( 'buffer' )
32
32
with MockVimBuffers ( [ current_buffer ], [ current_buffer ] ):
33
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
34
- ycm .SendCommandRequest ( [ 'GoTo' ], 'aboveleft' , False , 1 , 1 )
33
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
34
+ ycm .SendCommandRequestAsync ( [ 'GoTo' ], False , 1 , 1 )
35
35
assert_that (
36
- # Positional arguments passed to SendCommandRequest .
36
+ # Positional arguments passed to SendCommandRequestAsync .
37
37
send_request .call_args [ 0 ],
38
38
contains_exactly (
39
39
contains_exactly ( 'GoTo' ),
40
- 'aboveleft' ,
41
- 'same-buffer' ,
42
40
has_entries ( {
43
41
'options' : has_entries ( {
44
42
'tab_size' : 2 ,
@@ -47,46 +45,44 @@ def test_SendCommandRequest_ExtraConfVimData_Works( self, ycm ):
47
45
'extra_conf_data' : has_entries ( {
48
46
'tempname()' : '_TEMP_FILE_'
49
47
} ),
50
- } )
48
+ } ),
49
+ True
51
50
)
52
51
)
53
52
54
53
55
54
@YouCompleteMeInstance ( {
56
55
'g:ycm_extra_conf_vim_data' : [ 'undefined_value' ] } )
57
- def test_SendCommandRequest_ExtraConfData_UndefinedValue ( self , ycm ):
56
+ def test_SendCommandRequestAsync_ExtraConfData_UndefinedValue ( self , ycm ):
58
57
current_buffer = VimBuffer ( 'buffer' )
59
58
with MockVimBuffers ( [ current_buffer ], [ current_buffer ] ):
60
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
61
- ycm .SendCommandRequest ( [ 'GoTo' ], 'belowright' , False , 1 , 1 )
59
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
60
+ ycm .SendCommandRequestAsync ( [ 'GoTo' ], False , 1 , 1 )
62
61
assert_that (
63
- # Positional arguments passed to SendCommandRequest .
62
+ # Positional arguments passed to SendCommandRequestAsync .
64
63
send_request .call_args [ 0 ],
65
64
contains_exactly (
66
65
contains_exactly ( 'GoTo' ),
67
- 'belowright' ,
68
- 'same-buffer' ,
69
66
has_entries ( {
70
67
'options' : has_entries ( {
71
68
'tab_size' : 2 ,
72
69
'insert_spaces' : True ,
73
70
} )
74
- } )
71
+ } ),
72
+ True
75
73
)
76
74
)
77
75
78
76
79
77
@YouCompleteMeInstance ()
80
- def test_SendCommandRequest_BuildRange_NoVisualMarks ( self , ycm , * args ):
78
+ def test_SendCommandRequestAsync_BuildRange_NoVisualMarks ( self , ycm , * args ):
81
79
current_buffer = VimBuffer ( 'buffer' , contents = [ 'first line' ,
82
80
'second line' ] )
83
81
with MockVimBuffers ( [ current_buffer ], [ current_buffer ] ):
84
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
85
- ycm .SendCommandRequest ( [ 'GoTo' ], '' , True , 1 , 2 )
82
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
83
+ ycm .SendCommandRequestAsync ( [ 'GoTo' ], True , 1 , 2 )
86
84
send_request .assert_called_once_with (
87
85
[ 'GoTo' ],
88
- '' ,
89
- 'same-buffer' ,
90
86
{
91
87
'options' : {
92
88
'tab_size' : 2 ,
@@ -102,24 +98,23 @@ def test_SendCommandRequest_BuildRange_NoVisualMarks( self, ycm, *args ):
102
98
'column_num' : 12
103
99
}
104
100
}
105
- }
101
+ },
102
+ True
106
103
)
107
104
108
105
109
106
@YouCompleteMeInstance ()
110
- def test_SendCommandRequest_BuildRange_VisualMarks ( self , ycm , * args ):
107
+ def test_SendCommandRequestAsync_BuildRange_VisualMarks ( self , ycm , * args ):
111
108
current_buffer = VimBuffer ( 'buffer' ,
112
109
contents = [ 'first line' ,
113
110
'second line' ],
114
111
visual_start = [ 1 , 4 ],
115
112
visual_end = [ 2 , 8 ] )
116
113
with MockVimBuffers ( [ current_buffer ], [ current_buffer ] ):
117
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
118
- ycm .SendCommandRequest ( [ 'GoTo' ], 'tab' , True , 1 , 2 )
114
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
115
+ ycm .SendCommandRequestAsync ( [ 'GoTo' ], True , 1 , 2 )
119
116
send_request .assert_called_once_with (
120
117
[ 'GoTo' ],
121
- 'tab' ,
122
- 'same-buffer' ,
123
118
{
124
119
'options' : {
125
120
'tab_size' : 2 ,
@@ -135,31 +130,31 @@ def test_SendCommandRequest_BuildRange_VisualMarks( self, ycm, *args ):
135
130
'column_num' : 9
136
131
}
137
132
}
138
- }
133
+ },
134
+ True
139
135
)
140
136
141
137
142
138
@YouCompleteMeInstance ()
143
- def test_SendCommandRequest_IgnoreFileTypeOption ( self , ycm , * args ):
139
+ def test_SendCommandRequestAsync_IgnoreFileTypeOption ( self , ycm , * args ):
144
140
current_buffer = VimBuffer ( 'buffer' )
145
141
with MockVimBuffers ( [ current_buffer ], [ current_buffer ] ):
146
142
expected_args = (
147
143
[ 'GoTo' ],
148
- '' ,
149
- 'same-buffer' ,
150
144
{
151
145
'completer_target' : 'python' ,
152
146
'options' : {
153
147
'tab_size' : 2 ,
154
148
'insert_spaces' : True
155
149
},
156
- }
150
+ },
151
+ False
157
152
)
158
153
159
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
160
- ycm .SendCommandRequest ( [ 'ft=python' , 'GoTo' ], '' , False , 1 , 1 )
154
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
155
+ ycm .SendCommandRequestAsync ( [ 'ft=python' , 'GoTo' ], False , 1 , 1 , False )
161
156
send_request .assert_called_once_with ( * expected_args )
162
157
163
- with patch ( 'ycm.youcompleteme.SendCommandRequest ' ) as send_request :
164
- ycm .SendCommandRequest ( [ 'GoTo' , 'ft=python' ], '' , False , 1 , 1 )
158
+ with patch ( 'ycm.youcompleteme.SendCommandRequestAsync ' ) as send_request :
159
+ ycm .SendCommandRequestAsync ( [ 'GoTo' , 'ft=python' ], False , 1 , 1 , False )
165
160
send_request .assert_called_once_with ( * expected_args )
0 commit comments