##// END OF EJS Templates
Test completion.
gvaroquaux -
Show More
@@ -204,6 +204,12 b' class LineFrontEndBase(FrontEndBase):'
204 204 print >>sys.__stdout__, completions
205 205
206 206
207 def get_line_width(self):
208 """ Return the width of the line in characters.
209 """
210 return 80
211
212
207 213 def write_completion(self, possibilities):
208 214 """ Write the list of possible completions.
209 215 """
@@ -212,8 +218,8 b' class LineFrontEndBase(FrontEndBase):'
212 218 self.write('\n')
213 219 max_len = len(max(possibilities, key=len)) + 1
214 220
215 #now we check how much symbol we can put on a line...
216 chars_per_line =self.get_line_width()
221 # Now we check how much symbol we can put on a line...
222 chars_per_line = self.get_line_width()
217 223 symbols_per_line = max(1, chars_per_line/max_len)
218 224
219 225 pos = 1
@@ -231,7 +237,6 b' class LineFrontEndBase(FrontEndBase):'
231 237 self.input_buffer = current_buffer
232 238
233 239
234
235 240 def new_prompt(self, prompt):
236 241 """ Prints a prompt and starts a new editing buffer.
237 242
@@ -115,6 +115,9 b' def test_completion():'
115 115 f.input_buffer = 'zzzb = 2'
116 116 f._on_enter()
117 117 f.input_buffer = 'zz'
118 f.complete_current_input()
119 assert f.out.getvalue() == '\nzzza zzzb '
120 assert f.input_buffer == 'zzz'
118 121
119 122
120 123 if __name__ == '__main__':
@@ -123,3 +126,4 b" if __name__ == '__main__':"
123 126 test_execution()
124 127 test_multiline()
125 128 test_capture()
129 test_completion()
General Comments 0
You need to be logged in to leave comments. Login now